Browse Source

修改小程序砍价逻辑

master
Gao xiaosong 5 years ago
parent
commit
2e55f39775
  1. 4
      config/index.js
  2. 2
      libs/wechat.js
  3. 5
      main.js
  4. 4
      pages/Loading/index.vue
  5. 401
      pages/activity/DargainDetails/index.vue
  6. 4
      pages/shop/GoodsCon/index.vue
  7. 6
      utils/index.js

4
config/index.js

@ -1,8 +1,8 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'; export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api';
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'; // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api';
export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';

2
libs/wechat.js

@ -153,6 +153,8 @@ export async function auth(code) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let loginType = cookie.get(LOGINTYPE); let loginType = cookie.get(LOGINTYPE);
let spread = cookie.get('spread'); let spread = cookie.get('spread');
alert(spread)
debugger
wechatAuth(code, spread, loginType) wechatAuth(code, spread, loginType)
.then(({ data }) => { .then(({ data }) => {
console.log(data) console.log(data)

5
main.js

@ -125,7 +125,10 @@ if (!cookie.has(CACHE_KEY)) {
} }
var urlSpread = parseQuery()["spread"]; var urlSpread = parseQuery()["spread"];
cookie.set("spread", urlSpread || 0); if (urlSpread) {
cookie.set("spread", urlSpread);
}
// #endif // #endif

4
pages/Loading/index.vue

@ -43,7 +43,9 @@
// //
if (url) { if (url) {
let urlSpread = parseInt(url.spread); let urlSpread = parseInt(url.spread);
cookie.set("spread", urlSpread || 0); if (urlSpread) {
cookie.set("spread", urlSpread);
}
} }
// if (this.$deviceType == "app" || this.$deviceType == "weixinh5") { // if (this.$deviceType == "app" || this.$deviceType == "weixinh5") {
// this.$yrouter.switchTab({ // this.$yrouter.switchTab({

401
pages/activity/DargainDetails/index.vue

@ -1,9 +1,11 @@
<template> <template>
<view class="bargain on"> <view class="bargain on">
<!-- 在header上加 on 为请求支援 --> <!-- 在header上加 on 为请求支援 -->
<view :class="[bargainPartake != userInfo.uid ? 'wrapper bargain-box on user' : 'wrapper bargain-box user']" <!-- 当前登录的用户和url上携带的用户id不一致视为被邀请砍价 -->
v-if="bargainUserInfo && bargainPartake != userInfo.uid"> <view class="wrapper bargain-box on user" v-if="bargainUserInfo && bargainUid != userInfo.uid">
<!-- <view class="people">{{ lookCount }}人查看 {{ shareCount }}人分享 {{ userCount }}人参与</view> --> <!-- <view class="people">
{{ bargainShare.lookCount }}人查看 {{ bargainShare.shareCount }}人分享 {{ bargainShare.userCount }}人参与
</view> -->
<!-- 帮助砍价帮砍成功--> <!-- 帮助砍价帮砍成功-->
<view class="pictxt acea-row row-center-wrapper "> <view class="pictxt acea-row row-center-wrapper ">
<div class="bargain-header"> <div class="bargain-header">
@ -20,79 +22,70 @@
<view class="wrapper bargain-box time on"> <view class="wrapper bargain-box time on">
<div class="pictxt "> <div class="pictxt ">
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" <count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '"
:secondText="' 秒'" :datatime="datatime"></count-down> :secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down>
</div> </div>
</view> </view>
<view class="wrapper bargain-box bargain-product"> <view class="wrapper bargain-box bargain-product">
<view class="pictxt acea-row row-between-wrapper" @click="openAlone"> <view class="pictxt acea-row row-between-wrapper" @click="openAlone">
<view class="pictrue"> <view class="pictrue">
<image :src="bargain.image" /> <image :src="goodsDetail.image" />
<view class="bargain_view"> <view class="bargain_view">
查看商品 查看商品
<view class="iconfont icon-jiantou iconfonts"></view> <view class="iconfont icon-jiantou iconfonts"></view>
</view> </view>
</view> </view>
<view class="text acea-row row-column-around"> <view class="text acea-row row-column-around">
<view class="line2" v-text="bargain.title"></view> <view class="line2" v-text="goodsDetail.title"></view>
<view class="money font-color-red"> <view class="money font-color-red">
已砍至: 已砍至:
<text class="num" v-text="price"></text> <text class="num" v-text="bargainHelpCount.remainingPrice"></text>
</view> </view>
<view class="acea-row row-middle"> <view class="acea-row row-middle">
<view class="successNum" v-text="'原价' + bargain.price"></view> <view class="successNum" v-text="'原价' + goodsDetail.price"></view>
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view> <view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view>
</view> </view>
</view> </view>
</view> </view>
<!-- 砍价进度条 -->
<view class="cu-progress acea-row row-middle round margin-top"> <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 class="acea-row row-middle bg-red" :style="{ width: bargainHelpCount.pricePercent + '%' }"></view>
</view> </view>
<!-- 砍价进度条下的金额 -->
<view class="balance acea-row row-between-wrapper"> <view class="balance acea-row row-between-wrapper">
<view v-text="'已砍' + alreadyPrice + '元'"></view> <view v-text="'已砍' + bargainHelpCount.alreadyPrice + '元'"></view>
<view v-if="surplusPrice === 0">砍价成功</view> <view v-if="bargainHelpCount.remainingPrice === 0">砍价成功</view>
<view v-else v-text="'还剩' + surplusPrice + '元'"></view> <view v-else v-text="'还剩' + bargainHelpCount.remainingPrice + '元'"></view>
</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 && surplusPrice 砍价剩余金额为0
bargainPartake === userInfo.uid && bargainUid 砍价人为发起砍价用户
userBargainStatus === 1 && userBargainStatus 砍价状态为
!helpListLoading -->
"> <view class="bargainSuccess" v-if="pay">
<span class="iconfont icon-xiaolian"></span>恭喜您砍价成功快去支付吧~ <span class="iconfont icon-xiaolian"></span>恭喜您砍价成功快去支付吧~
</view> </view>
<view v-if="userBargainStatus == 0 && bargainPartake === userInfo.uid" class="bargainBnt" @click="goParticipate"> <!-- 参与砍价按钮 同一人-->
立即参与砍价</view> <view v-if="participate" class="bargainBnt" @click="goParticipate">立即参与砍价</view>
<view class="bargainBnt" @click="goPoster" v-if="
surplusPrice > 0 && <!-- 邀请好友按钮 -->
bargainPartake === userInfo.uid && <view v-if="inviteFriends" class="bargainBnt" @click="goPoster">邀请好友帮砍价</view>
userBargainStatus === 1 &&
!helpListLoading <!-- 帮砍好友砍按钮 -->
">邀请好友帮砍价</view> <view v-if="helpFriendsBargain" class="bargainBnt" @click="getBargainHelp">帮好友砍一刀</view>
<view class="bargainBnt" @click="getBargainHelp" v-else-if="
bargainPartake != userInfo.uid && <!-- 发起砍价按钮 非同一人-->
userBargainStatus == 1 && <view v-if="bargain" class="bargainBnt" @click="getBargainStart">我也要参与</view>
statusUser &&
!helpListLoading <!-- 支付按钮 -->
">帮好友砍一刀</view> <view class="bargainBnt" @click="goPay" v-if="pay">立即支付</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="bargainBnt on" @click="goList">抢更多商品</view>
<view class="tip"> <view class="tip">已有<span class="font-color-red" v-text="bargainHelpCount.count"></span>位好友成功帮您砍价</view>
已有
<span class="font-color-red" v-text="helpCount"></span>
位好友成功帮您砍价
</view>
<view class="lock"></view> <view class="lock"></view>
</view> </view>
<view class="bargainGang bargain-box"> <view class="bargainGang bargain-box">
@ -123,7 +116,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="load font-color-red" v-if="!helpListStatus && !helpListLoading" @click="getBargainHelpList">点击加载更多 <view class="load font-color-red" v-if="!helpListStatus " @click="getBargainHelpList">点击加载更多
</view> </view>
<view class="lock"></view> <view class="lock"></view>
</view> </view>
@ -137,7 +130,7 @@
<image src="@/static/images/left.png" /> <image src="@/static/images/left.png" />
</view> </view>
</view> </view>
<view class="conter" v-html="bargain.description"></view> <view class="conter" v-html="goodsDetail.description"></view>
<view class="lock"></view> <view class="lock"></view>
</view> </view>
<view class="goodsDetails bargain-box"> <view class="goodsDetails bargain-box">
@ -150,21 +143,17 @@
<image src="@/static/images/left.png" /> <image src="@/static/images/left.png" />
</view> </view>
</view> </view>
<view class="conter" v-html="bargain.rule"></view> <view class="conter" v-html="goodsDetail.rule"></view>
</view> </view>
<view class="bargainTip" :class="active === true ? 'on' : ''"> <view class="bargainTip" :class="active === true ? 'on' : ''">
<!-- <view class="pictrue"> <view class="cutOff" v-if="bargainUid === userInfo.uid">
<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>听说分享次数越多砍价成功的机会越大哦 <text class="font-color-red" v-text="bargainHelpPrice"></text>听说分享次数越多砍价成功的机会越大哦
</view> </view>
<view class="cutOff on" v-else> <view class="cutOff on" v-else>
<view class="help font-color-red" v-text="'成功帮砍' + bargainHelpPrice + '元'"></view>您也可以砍价低价拿哦快去挑选心仪的商品吧~ <view class="help font-color-red" v-text="'成功帮砍' + bargainHelpPrice + '元'"></view>您也可以砍价低价拿哦快去挑选心仪的商品吧~
</view> </view>
<view class="tipBnt" @click="goPoster" v-if="bargainPartake === userInfo.uid">邀请好友帮砍价</view> <view class="tipBnt" @click="goPoster" v-if="bargainUid === userInfo.uid">邀请好友帮砍价</view>
<view class="tipBnt" @click="getBargainStart" v-else>我也要参与</view> <view class="tipBnt" @click="getBargainStart" v-else>我也要参与</view>
</view> </view>
<view class="mask" @touchmove.prevent :hidden="active === false" @click="close"></view> <view class="mask" @touchmove.prevent :hidden="active === false" @click="close"></view>
@ -207,88 +196,50 @@
return { return {
price: 0, price: 0,
bargainId: 0, // bargainId: 0, //
bargainPartake: 0, //
bargain: [], // bargain: [], //
partake: null, partake: null,
bargainSumCount: 0, // bargainSumCount: 0, //
activeMsg: "", activeMsg: "",
// ssssss
active: false, active: false,
loading: false, loading: false,
datatime: 0,
lookCount: 0, // lookCount: 0, //
shareCount: 0, // shareCount: 0, //
userCount: 0, // userCount: 0, //
bargainHelpPrice: 0, // bargainHelpPrice: 0, //
bargainHelpList: [], bargainHelpList: [],
helpListStatus: false, // false true helpListStatus: false, // false true
helpListLoading: false, // false true
page: 1, // page: 1, //
limit: 2, // limit: 2, //
helpCount: 0, //
surplusPrice: 0, //
alreadyPrice: 0, //
pricePercent: 0, // pricePercent: 0, //
bargainUserInfo: [], //
userBargainStatus: 2, //
statusUser: false // ,truefalse bargainShare: {}, //
bargainHelpCount: {}, //
goodsDetail: {}, //
bargainUserInfo: [], //
bargainUid: 0, //
pay: false, //
bargain: false, //
participate: false, //
inviteFriends: false, //
helpFriendsBargain: false, //
bargainSuccess: false, //
mainBargainSuccess: false, //
}; };
}, },
computed: mapGetters(["userInfo", "isLogin"]), computed: mapGetters(["userInfo", "isLogin"]),
// watch: {
// $yroute: function(n) {
// var that = this;
// if (n.name === NAME) {
// that.mountedStart();
// }
// }
// },
mounted: function () { mounted: function () {
var that = this; this.mountedStart();
that.mountedStart();
setTimeout(function () {
that.loading = true;
}, 500);
}, },
methods: { methods: {
onShareAppMessage: function () { //
return {
title: this.storeInfo.title,
imageUrl: this.storeInfo.image,
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
"uid"),
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
}
}
},
//
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 () { mountedStart: function () {
var that = this; var that = this;
console.log(this)
let url = handleQrCode(); let url = handleQrCode();
console.log(url)
if (url) { if (url) {
//
that.bargainId = url.bargainId; that.bargainId = url.bargainId;
that.partake = url.uid; that.partake = url.partake;
} else { } else {
that.bargainId = that.$yroute.query.id; that.bargainId = that.$yroute.query.id;
that.partake = parseInt(that.$yroute.query.partake); that.partake = parseInt(that.$yroute.query.partake);
@ -298,25 +249,43 @@
this.partake <= 0 || this.partake <= 0 ||
isNaN(this.partake) isNaN(this.partake)
) { ) {
that.bargainPartake = that.userInfo.uid; // urluiduid
// that.$yrouter.push({ that.bargainUid = that.userInfo.uid;
// path: "/pages/activity/DargainDetails/index", that.$yrouter.push({
// query: { id: that.bargainId, partake: that.bargainPartake } path: "/pages/activity/DargainDetails/index",
// }); query: {
id: that.bargainId,
partake: that.bargainUid
}
});
return
} else { } else {
that.bargainPartake = parseInt(this.partake); that.bargainUid = this.partake;
} }
//
that.getBargainHelpCountStart();
that.getBargainDetail(); that.getBargainDetail();
//
that.getBargainShare(0); that.getBargainShare(0);
// if (that.bargainPartake !== that.userInfo.uid) that.getBargainStartUser(); if (that.bargainUid !== that.userInfo.uid) {
if (that.bargainPartake === that.userInfo.uid) {
// that.getBargainStart();
} else {
that.getBargainStartUser(); that.getBargainStartUser();
} }
}, },
//
goParticipate() {
if (this.bargainUid === this.userInfo.uid) {
this.getBargainStart()
} else {
this.getBargainStartUser();
}
this.getBargainHelpCount();
},
//
openAlone: function () {
this.$yrouter.push({
path: "/detail/" + this.bargain.productId
});
},
//
goPay: function () { goPay: function () {
var data = {}; var data = {};
var that = this; var that = this;
@ -342,6 +311,7 @@
}); });
}); });
}, },
//
goPoster: function () { goPoster: function () {
var that = this; var that = this;
that.getBargainShare(that.bargainId); that.getBargainShare(that.bargainId);
@ -353,6 +323,7 @@
} }
}); });
}, },
//
goList: function () { goList: function () {
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/activity/GoodsBargain/index" path: "/pages/activity/GoodsBargain/index"
@ -366,9 +337,7 @@
getBargainShare({ getBargainShare({
bargainId: bargainId bargainId: bargainId
}).then(res => { }).then(res => {
that.lookCount = res.data.lookCount; that.bargainShare = res.data
that.shareCount = res.data.shareCount;
that.userCount = res.data.userCount;
}); });
}, },
// //
@ -376,19 +345,17 @@
var that = this; var that = this;
getBargainDetail(that.bargainId) getBargainDetail(that.bargainId)
.then(res => { .then(res => {
that.bargain = res.data.bargain; that.goodsDetail = res.data.bargain;
that.bargain.description = that.bargain.description.replace( that.goodsDetail.description = that.goodsDetail.description.replace(
/\<img/gi, /\<img/gi,
'<img style="max-width:100%;height:auto;"' '<img style="max-width:100%;height:auto;"'
); );
that.bargain.rule = that.bargain.rule.replace( that.goodsDetail.rule = that.goodsDetail.rule.replace(
/\<img/gi, /\<img/gi,
'<img style="max-width:100%;height:auto;"' '<img style="max-width:100%;height:auto;"'
); );
that.datatime = that.bargain.stopTime / 1000; that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000
that.getBargainHelpCount(); that.getBargainHelpCount();
// that.setOpenShare();
that.getBargainHelpList();
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
@ -405,7 +372,7 @@
bargainId: that.bargainId bargainId: that.bargainId
}) })
.then(() => { .then(() => {
that.bargainPartake = that.userInfo.uid; that.bargainUid = that.userInfo.uid;
that.getBargainHelp(); that.getBargainHelp();
}) })
.catch(res => { .catch(res => {
@ -420,8 +387,8 @@
getBargainHelp: function () { getBargainHelp: function () {
var that = this; var that = this;
if ( if (
that.surplusPrice === 0 && this.bargainHelpCount.remainingPrice === 0 &&
that.bargainPartake !== that.userInfo.uid that.bargainUid !== that.userInfo.uid
) { ) {
return uni.showToast({ return uni.showToast({
title: "好友已经砍价成功", title: "好友已经砍价成功",
@ -431,15 +398,12 @@
} }
var data = { var data = {
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainPartake bargainUserUid: that.bargainUid
}; };
getBargainHelp(data) getBargainHelp(data)
.then(res => { .then(res => {
that.activeMsg = res.data.status; that.activeMsg = res.data.status;
if ( if (res.data.status === "SUCCESSFUL" && that.bargainUid !== that.userInfo.uid) {
res.data.status === "SUCCESSFUL" &&
that.bargainPartake !== that.userInfo.uid
) {
uni.showToast({ uni.showToast({
title: "您已经砍过了", title: "您已经砍过了",
icon: "none", icon: "none",
@ -463,15 +427,12 @@
// //
getBargainHelpPrice: function () { getBargainHelpPrice: function () {
var that = this; var that = this;
that.helpListLoading = true;
getBargainHelpPrice({ getBargainHelpPrice({
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainPartake bargainUserUid: that.bargainUid
}) })
.then(res => { .then(res => {
that.bargainHelpPrice = res.data.price; that.bargainHelpPrice = res.data.price;
that.helpListLoading = false;
that.getBargainHelpCount(); that.getBargainHelpCount();
that.getBargainHelpList(); that.getBargainHelpList();
switch (that.activeMsg) { switch (that.activeMsg) {
@ -490,28 +451,24 @@
}); });
}); });
}, },
// //
getBargainHelpList: function () { getBargainHelpList: function () {
var that = this; var that = this;
if (that.helpListLoading === true) return;
if (that.helpListStatus === true) return; if (that.helpListStatus === true) return;
that.helpListLoading = true;
getBargainHelpList({ getBargainHelpList({
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainPartake, bargainUserUid: that.bargainUid,
page: that.page, page: that.page,
limit: that.limit limit: that.limit
}) })
.then(res => { .then(res => {
that.helpListStatus = res.data.length < that.limit; that.helpListStatus = res.data.length < that.limit;
that.helpListLoading = false;
that.page++; that.page++;
if (res.data) { if (res.data) {
that.bargainHelpList.push.apply(that.bargainHelpList, res.data); that.bargainHelpList.push.apply(that.bargainHelpList, res.data);
} }
}) })
.catch(err => { .catch(err => {
console.log(err)
if (!err.msg) { if (!err.msg) {
return return
} }
@ -522,53 +479,100 @@
}); });
}); });
}, },
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
// }
// });
});
},
getBargainHelpCount: function () { getBargainHelpCount: function () {
var that = this;
getBargainHelpCount({ getBargainHelpCount({
bargainId: that.bargainId, bargainId: this.bargainId,
bargainUserUid: that.bargainPartake bargainUserUid: this.bargainUid
}) })
.then(res => { .then(res => {
that.userBargainStatus = res.data.status; // = -
that.helpCount = res.data.count; let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2)
that.surplusPrice = res.data.price; this.bargainHelpCount = {
that.alreadyPrice = res.data.alreadyPrice; ...res.data,
that.pricePercent = res.data.pricePercent; remainingPrice
that.price = (that.bargain.price - that.alreadyPrice).toFixed(2); }
console.log(that); this.handleButtonStatus()
}) })
.catch(() => { .catch(err => {
that.bargainPartake = that.userInfo.uid; if (!err.msg) {
// that.$yrouter.push({ return
// path: "/pages/activity/DargainDetails/index", }
// query: { id: that.bargainId, partake: that.userInfo.uid } uni.showToast({
// }); title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none",
duration: 2000
});
}); });
}, },
//
handleButtonStatus() {
//
// 1. ==> &&
if (
this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 0
) {
this.participate = true
} else {
this.participate = false
}
// 2. ==> && && >0
if (
this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 1 &&
this.bargainHelpCount.remainingPrice > 0
) {
this.inviteFriends = true
} else {
this.inviteFriends = false
}
// 3. ==> && && >0 &&
if (
this.bargainUid != this.userInfo.uid &&
this.bargainHelpCount.status == 1 &&
// this.bargainHelpCount.userBargainStatus &&
this.bargainHelpCount.remainingPrice > 0
) {
this.helpFriendsBargain = true
} else {
this.helpFriendsBargain = false
}
// 4. ==> && && <=0
if (
this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 1 &&
this.bargainHelpCount.remainingPrice <= 0
) {
this.pay = true
} else {
this.pay = false
}
// 5. ==> &&
if (
this.bargainUid != this.userInfo.uid
) {
this.bargain = true
}else{
this.bargain = false
}
//
// 1. ==> &&
// 2. ==> &&
// 3. ==> && true
},
//
getBargainStartUser: function () { getBargainStartUser: function () {
var that = this; var that = this;
getBargainStartUser({ getBargainStartUser({
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainPartake bargainUserUid: that.bargainUid
}) })
.then(res => { .then(res => {
that.bargainUserInfo = res.data; that.bargainUserInfo = res.data;
@ -582,9 +586,30 @@
}); });
}); });
}, },
//
close: function () { close: function () {
this.active = false; this.active = false;
},
//
onShareAppMessage: function () {
return {
title: this.storeInfo.title,
imageUrl: this.storeInfo.image,
path: "pages/activity/DargainDetails/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync(
"uid"),
success(res) {
uni.showToast({
title: '分享成功'
})
},
fail(res) {
uni.showToast({
title: '分享失败',
icon: 'none'
})
} }
}
},
}, },
onShareAppMessage() { onShareAppMessage() {
return { return {

4
pages/shop/GoodsCon/index.vue

@ -311,7 +311,9 @@
if (url && url.id) { if (url && url.id) {
this.id = url.id; this.id = url.id;
let urlSpread = parseInt(url.spread); let urlSpread = parseInt(url.spread);
cookie.set("spread", urlSpread || 0); if (urlSpread) {
cookie.set("spread", urlSpread);
}
} else { } else {
this.id = this._route.query.id; this.id = this._route.query.id;
} }

6
utils/index.js

@ -889,7 +889,9 @@ export const handleLoginFailure = () => {
id: qrCode.pinkId, id: qrCode.pinkId,
} }
}) })
if (qrCode.spread) {
cookie.set("spread", qrCode.spread || 0); cookie.set("spread", qrCode.spread || 0);
}
} else { } else {
console.log('————————') console.log('————————')
console.log('是拼团进来的,但是没有获取到参数') console.log('是拼团进来的,但是没有获取到参数')
@ -912,7 +914,9 @@ export const handleLoginFailure = () => {
partake: qrCode.uid partake: qrCode.uid
} }
}) })
if (qrCode.spread) {
cookie.set("spread", qrCode.spread || 0); cookie.set("spread", qrCode.spread || 0);
}
} else { } else {
handleNoParameters() handleNoParameters()
console.log('————————') console.log('————————')
@ -933,7 +937,9 @@ export const handleLoginFailure = () => {
id: qrCode.productId, id: qrCode.productId,
} }
}) })
if (qrCode.spread) {
cookie.set("spread", qrCode.spread || 0); cookie.set("spread", qrCode.spread || 0);
}
} else { } else {
handleNoParameters() handleNoParameters()
console.log('————————') console.log('————————')

Loading…
Cancel
Save