Browse Source

修改砍价逻辑

zyh
Gaoxs 4 years ago
parent
commit
e380e64198
  1. 4
      config/index.js
  2. 5
      libs/wechat.js
  3. 37
      pages/activity/DargainDetails/index.vue
  4. 1
      pages/shop/GoodsCon/index.vue

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';

5
libs/wechat.js

@ -109,6 +109,11 @@ export function wechat() {
}) })
.catch(error => { .catch(error => {
console.log(error) console.log(error)
uni.showToast({
title: error,
icon: "none",
duration: 2000
});
reject() reject()
}); });
}) })

37
pages/activity/DargainDetails/index.vue

@ -70,7 +70,7 @@
</view> </view>
<!-- 参与砍价按钮 同一人--> <!-- 参与砍价按钮 同一人-->
<view v-if="participate" class="bargainBnt" @click="goParticipate">立即参与砍价</view> <view v-if="participate" class="bargainBnt" @click="goParticipate">立即发起砍价</view>
<!-- 邀请好友按钮 --> <!-- 邀请好友按钮 -->
<view v-if="inviteFriends" class="bargainBnt" @click="goPoster">邀请好友帮砍价</view> <view v-if="inviteFriends" class="bargainBnt" @click="goPoster">邀请好友帮砍价</view>
@ -79,7 +79,7 @@
<view v-if="helpFriendsBargain" class="bargainBnt" @click="getBargainHelp">帮好友砍一刀</view> <view v-if="helpFriendsBargain" class="bargainBnt" @click="getBargainHelp">帮好友砍一刀</view>
<!-- 发起砍价按钮 非同一人--> <!-- 发起砍价按钮 非同一人-->
<view v-if="bargain" class="bargainBnt" @click="getBargainStart">我也要参与</view> <view v-if="bargain" class="bargainBnt" @click="getBargainStart">我也要砍价</view>
<!-- 支付按钮 --> <!-- 支付按钮 -->
<view class="bargainBnt" @click="goPay" v-if="pay">立即支付</view> <view class="bargainBnt" @click="goPay" v-if="pay">立即支付</view>
@ -227,6 +227,8 @@
mountedStart: function () { mountedStart: function () {
var that = this; var that = this;
let url = handleQrCode(); let url = handleQrCode();
// bargainId id
// bargainUid
if (url) { if (url) {
// //
that.bargainId = url.bargainId; that.bargainId = url.bargainId;
@ -250,11 +252,14 @@
that.getBargainStartUser(); that.getBargainStartUser();
} }
}, },
// //
goParticipate() { goParticipate() {
//
if (this.bargainUid === this.userInfo.uid) { if (this.bargainUid === this.userInfo.uid) {
this.getBargainStart() //
this.getBargainStart();
} else { } else {
//
this.getBargainStartUser(); this.getBargainStartUser();
} }
this.getBargainHelpCount(); this.getBargainHelpCount();
@ -323,8 +328,13 @@
// //
getBargainDetail: function () { getBargainDetail: function () {
var that = this; var that = this;
uni.showLoading({
title: "加载中",
mask: true
});
getBargainDetail(that.bargainId) getBargainDetail(that.bargainId)
.then(res => { .then(res => {
uni.hideLoading()
that.goodsDetail = res.data.bargain; that.goodsDetail = res.data.bargain;
that.goodsDetail.description = that.goodsDetail.description.replace( that.goodsDetail.description = that.goodsDetail.description.replace(
/\<img/gi, /\<img/gi,
@ -338,6 +348,7 @@
that.getBargainHelpCount(); that.getBargainHelpCount();
}) })
.catch(res => { .catch(res => {
uni.hideLoading()
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: "none",
@ -345,7 +356,7 @@
}); });
}); });
}, },
// // -
getBargainStart: function () { getBargainStart: function () {
var that = this; var that = this;
getBargainStart({ getBargainStart({
@ -354,6 +365,7 @@
.then(() => { .then(() => {
that.bargainUid = that.userInfo.uid; that.bargainUid = that.userInfo.uid;
that.getBargainHelp(); that.getBargainHelp();
that.getBargainHelpCount();
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
@ -488,7 +500,7 @@
// //
handleButtonStatus() { handleButtonStatus() {
// //
// 1. ==> && // 1. ==> &&
if ( if (
this.bargainUid === this.userInfo.uid && this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 0 this.bargainHelpCount.status == 0
@ -498,7 +510,7 @@
this.participate = false this.participate = false
} }
// 2. ==> && && >0 // 2. ==> && && >0
if ( if (
this.bargainUid === this.userInfo.uid && this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 1 && this.bargainHelpCount.status == 1 &&
@ -509,7 +521,7 @@
this.inviteFriends = false this.inviteFriends = false
} }
// 3. ==> && && >0 && // 3. ==> && && >0 &&
if ( if (
this.bargainUid != this.userInfo.uid && this.bargainUid != this.userInfo.uid &&
this.bargainHelpCount.status == 1 && this.bargainHelpCount.status == 1 &&
@ -521,7 +533,7 @@
this.helpFriendsBargain = false this.helpFriendsBargain = false
} }
// 4. ==> && && <=0 // 4. ==> && && <=0
if ( if (
this.bargainUid === this.userInfo.uid && this.bargainUid === this.userInfo.uid &&
this.bargainHelpCount.status == 1 && this.bargainHelpCount.status == 1 &&
@ -532,7 +544,7 @@
this.pay = false this.pay = false
} }
// 5. ==> && // 5. ==> &&
if ( if (
this.bargainUid != this.userInfo.uid this.bargainUid != this.userInfo.uid
) { ) {
@ -542,12 +554,13 @@
} }
// //
// 1. ==> && // 1. ==> &&
// 2. ==> && // 2. ==> &&
// 3. ==> && true // 3. ==> && true
}, },
// //
//
getBargainStartUser: function () { getBargainStartUser: function () {
var that = this; var that = this;
getBargainStartUser({ getBargainStartUser({

1
pages/shop/GoodsCon/index.vue

@ -217,6 +217,7 @@
getCollectDel, getCollectDel,
getUserInfo, getUserInfo,
} from "@/api/user"; } from "@/api/user";
import cookie from "@/utils/store/cookie";
import { import {
isWeixin, isWeixin,
PosterCanvas, PosterCanvas,

Loading…
Cancel
Save