修改不兼容多平台的语法
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
<!-- 帮助砍价、帮砍成功:-->
|
||||
<view class="pictxt acea-row row-center-wrapper ">
|
||||
<div class="bargain-header">
|
||||
<view class="pictrue"><image :src="bargainUserInfo.avatar" /></view>
|
||||
<view class="pictrue"><image :src="bargainUserInfo.avatar"/></view>
|
||||
<view class="text">
|
||||
{{ bargainUserInfo.nickname }}
|
||||
<text>邀请您帮忙砍价</text>
|
||||
@ -19,15 +19,7 @@
|
||||
</view>
|
||||
<view class="wrapper bargain-box time on">
|
||||
<div class="pictxt ">
|
||||
<count-down
|
||||
:isDay="true"
|
||||
:tipText="'倒计时 '"
|
||||
:dayText="' 天 '"
|
||||
:hourText="' 时 '"
|
||||
:minuteText="' 分 '"
|
||||
:secondText="' 秒'"
|
||||
:datatime="goodsDetail.stopTime"
|
||||
></count-down>
|
||||
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down>
|
||||
</div>
|
||||
</view>
|
||||
<view class="wrapper bargain-box bargain-product">
|
||||
@ -100,14 +92,14 @@
|
||||
</view>
|
||||
<view class="bargainGang bargain-box">
|
||||
<view class="title font-color-red acea-row row-center-wrapper">
|
||||
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
|
||||
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
|
||||
<view class="titleCon">砍价帮</view>
|
||||
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
|
||||
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.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="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>
|
||||
@ -124,18 +116,18 @@
|
||||
</view>
|
||||
<view class="goodsDetails bargain-box">
|
||||
<view class="title font-color-red acea-row row-center-wrapper">
|
||||
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
|
||||
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
|
||||
<view class="titleCon">商品详情</view>
|
||||
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
|
||||
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
|
||||
</view>
|
||||
<view class="conter" v-html="goodsDetail.description"></view>
|
||||
<view class="lock"></view>
|
||||
</view>
|
||||
<view class="goodsDetails bargain-box">
|
||||
<view class="title font-color-red acea-row row-center-wrapper">
|
||||
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
|
||||
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
|
||||
<view class="titleCon">活动规则</view>
|
||||
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
|
||||
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
|
||||
</view>
|
||||
<view class="conter" v-html="goodsDetail.rule"></view>
|
||||
</view>
|
||||
@ -156,28 +148,19 @@
|
||||
</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';
|
||||
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';
|
||||
const NAME = 'DargainDetails'
|
||||
|
||||
export default {
|
||||
name: 'DargainDetails',
|
||||
components: {
|
||||
CountDown
|
||||
CountDown,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
@ -203,41 +186,41 @@ export default {
|
||||
inviteFriends: false, // 邀请好友
|
||||
helpFriendsBargain: false, // 帮好友砍
|
||||
bargainSuccess: false, // 帮好友砍价成功
|
||||
mainBargainSuccess: false // 砍价成功
|
||||
};
|
||||
mainBargainSuccess: false, // 砍价成功
|
||||
}
|
||||
},
|
||||
computed: mapGetters(['userInfo', 'isLogin']),
|
||||
mounted: function() {
|
||||
this.mountedStart();
|
||||
this.mountedStart()
|
||||
},
|
||||
methods: {
|
||||
// 开始处理砍价逻辑
|
||||
mountedStart: function() {
|
||||
var that = this;
|
||||
let url = handleQrCode();
|
||||
var that = this
|
||||
let url = handleQrCode()
|
||||
// bargainId 砍价商品id
|
||||
// bargainUid 发起砍价人
|
||||
if (url) {
|
||||
// 通过二维码进来
|
||||
that.bargainId = url.bargainId;
|
||||
that.bargainUid = url.partake;
|
||||
that.bargainId = url.bargainId
|
||||
that.bargainUid = url.partake
|
||||
} else {
|
||||
// 正常途径进来
|
||||
that.bargainId = that.$yroute.query.id;
|
||||
that.bargainUid = that.$yroute.query.partake;
|
||||
that.bargainId = that.$yroute.query.id
|
||||
that.bargainUid = that.$yroute.query.partake
|
||||
}
|
||||
if (this.bargainUid == 0 || !this.bargainUid) {
|
||||
// url未携带用户uid,填上登录用户uid,跳转
|
||||
that.bargainUid = that.userInfo.uid;
|
||||
that.bargainUid = that.userInfo.uid
|
||||
}
|
||||
console.log(this);
|
||||
console.log(this)
|
||||
|
||||
// 获取商品详情
|
||||
that.getBargainDetail();
|
||||
that.getBargainDetail()
|
||||
// 砍价数据统计
|
||||
that.getBargainShare(0);
|
||||
that.getBargainShare(0)
|
||||
if (that.bargainUid !== that.userInfo.uid) {
|
||||
that.getBargainStartUser();
|
||||
that.getBargainStartUser()
|
||||
}
|
||||
},
|
||||
// 发起砍价
|
||||
@ -245,255 +228,258 @@ export default {
|
||||
//发起人和当前用户为同一人
|
||||
if (this.bargainUid === this.userInfo.uid) {
|
||||
// 变更为当前用户砍价页面
|
||||
this.getBargainStart();
|
||||
this.getBargainStart()
|
||||
} else {
|
||||
// 发起人与当前用户非同一人,变更为发起人的砍价页面
|
||||
this.getBargainStartUser();
|
||||
this.getBargainStartUser()
|
||||
}
|
||||
this.getBargainHelpCount();
|
||||
this.getBargainHelpCount()
|
||||
},
|
||||
// 查看商品
|
||||
openAlone: function() {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: {
|
||||
id: this.goodsDetail.productId
|
||||
}
|
||||
});
|
||||
id: this.goodsDetail.productId,
|
||||
},
|
||||
})
|
||||
},
|
||||
// 砍价完成,去支付
|
||||
goPay: function() {
|
||||
var data = {};
|
||||
var that = this;
|
||||
data.productId = that.goodsDetail.productId;
|
||||
data.cartNum = that.goodsDetail.num;
|
||||
data.uniqueId = '';
|
||||
data.bargainId = that.bargainId;
|
||||
data.new = 1;
|
||||
var data = {}
|
||||
var that = this
|
||||
data.productId = that.goodsDetail.productId
|
||||
data.cartNum = that.goodsDetail.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
|
||||
}
|
||||
});
|
||||
id: res.data.cartId,
|
||||
},
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 生成海报
|
||||
goPoster: function() {
|
||||
var that = this;
|
||||
that.getBargainShare(that.bargainId);
|
||||
var that = this
|
||||
that.getBargainShare(that.bargainId)
|
||||
this.$yrouter.push({
|
||||
path: '/pages/activity/Poster/index',
|
||||
query: {
|
||||
id: that.bargainId,
|
||||
type: 2
|
||||
}
|
||||
});
|
||||
type: 2,
|
||||
},
|
||||
})
|
||||
},
|
||||
// 跳转砍价商品列表
|
||||
goList: function() {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/activity/GoodsBargain/index'
|
||||
});
|
||||
path: '/pages/activity/GoodsBargain/index',
|
||||
})
|
||||
},
|
||||
//砍价分享
|
||||
//bargainId 0 获取 查看人数 分享人数 参与人数
|
||||
//bargainId 砍价产品编号 添加分享次数 获取 查看人数 分享人数 参与人数
|
||||
getBargainShare: function(bargainId) {
|
||||
var that = this;
|
||||
var that = this
|
||||
getBargainShare({
|
||||
bargainId: bargainId
|
||||
bargainId: bargainId,
|
||||
}).then(res => {
|
||||
that.bargainShare = res.data;
|
||||
});
|
||||
that.bargainShare = res.data
|
||||
})
|
||||
},
|
||||
// 获取产品详情
|
||||
getBargainDetail: function() {
|
||||
var that = this;
|
||||
var that = this
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
});
|
||||
mask: true,
|
||||
})
|
||||
getBargainDetail(that.bargainId)
|
||||
.then(res => {
|
||||
uni.hideLoading();
|
||||
that.goodsDetail = res.data.bargain;
|
||||
that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"');
|
||||
that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"');
|
||||
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000;
|
||||
that.getBargainHelpCount();
|
||||
uni.hideLoading()
|
||||
that.goodsDetail = res.data.bargain
|
||||
that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
|
||||
that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
|
||||
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000
|
||||
that.getBargainHelpCount()
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 开启砍价-发起人与当前用户非同一人
|
||||
getBargainStart: function() {
|
||||
var that = this;
|
||||
var that = this
|
||||
getBargainStart({
|
||||
bargainId: that.bargainId
|
||||
bargainId: that.bargainId,
|
||||
})
|
||||
.then(() => {
|
||||
that.bargainUid = that.userInfo.uid;
|
||||
that.getBargainHelp();
|
||||
that.getBargainHelpCount();
|
||||
that.bargainUid = that.userInfo.uid
|
||||
that.getBargainHelp()
|
||||
that.getBargainHelpCount()
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 参与砍价
|
||||
getBargainHelp: function() {
|
||||
var that = this;
|
||||
var that = this
|
||||
if (this.bargainHelpCount.price === 0 && that.bargainUid !== that.userInfo.uid) {
|
||||
return uni.showToast({
|
||||
title: '好友已经砍价成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
}
|
||||
var data = {
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainUid
|
||||
};
|
||||
bargainUserUid: that.bargainUid,
|
||||
}
|
||||
getBargainHelp(data)
|
||||
.then(res => {
|
||||
that.activeMsg = res.data.status;
|
||||
that.activeMsg = res.data.status
|
||||
if (res.data.status === 'SUCCESSFUL' && that.bargainUid !== that.userInfo.uid) {
|
||||
uni.showToast({
|
||||
title: '您已经砍过了',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
duration: 2000,
|
||||
})
|
||||
return
|
||||
}
|
||||
that.helpListStatus = false;
|
||||
that.page = 1;
|
||||
that.bargainHelpList = [];
|
||||
that.getBargainHelpPrice();
|
||||
that.helpListStatus = false
|
||||
that.page = 1
|
||||
that.bargainHelpList = []
|
||||
that.getBargainHelpPrice()
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
//获取砍掉的金额
|
||||
getBargainHelpPrice: function() {
|
||||
var that = this;
|
||||
var that = this
|
||||
getBargainHelpPrice({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainUid
|
||||
bargainUserUid: that.bargainUid,
|
||||
})
|
||||
.then(res => {
|
||||
that.bargainHelpPrice = res.data.price;
|
||||
that.getBargainHelpCount();
|
||||
that.getBargainHelpList();
|
||||
that.bargainHelpPrice = res.data.price
|
||||
that.getBargainHelpCount()
|
||||
that.getBargainHelpList()
|
||||
switch (that.activeMsg) {
|
||||
case 'SUCCESSFUL':
|
||||
break;
|
||||
break
|
||||
case 'SUCCESS':
|
||||
that.active = true;
|
||||
break;
|
||||
that.active = true
|
||||
break
|
||||
}
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 砍价帮助列表
|
||||
getBargainHelpList: function() {
|
||||
var that = this;
|
||||
if (that.helpListStatus === true) return;
|
||||
var that = this
|
||||
if (that.helpListStatus === true) return
|
||||
getBargainHelpList({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainUid,
|
||||
page: that.page,
|
||||
limit: that.limit
|
||||
limit: that.limit,
|
||||
})
|
||||
.then(res => {
|
||||
that.helpListStatus = res.data.length < that.limit;
|
||||
that.page++;
|
||||
that.helpListStatus = res.data.length < that.limit
|
||||
if (that.page == 1) {
|
||||
that.bargainHelpList = []
|
||||
}
|
||||
that.page++
|
||||
if (res.data) {
|
||||
that.bargainHelpList.push.apply(that.bargainHelpList, res.data);
|
||||
that.bargainHelpList.push.apply(that.bargainHelpList, res.data)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
if (!err.msg) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 砍价 砍价帮总人数、剩余金额、进度条、已经砍掉的价格
|
||||
getBargainHelpCount: function() {
|
||||
getBargainHelpCount({
|
||||
bargainId: this.bargainId,
|
||||
bargainUserUid: this.bargainUid
|
||||
bargainUserUid: this.bargainUid,
|
||||
})
|
||||
.then(res => {
|
||||
// 剩余砍价金额,显示已砍至¥** 使用 = 商品价格 - 已经砍掉的金额
|
||||
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2);
|
||||
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2)
|
||||
this.bargainHelpCount = {
|
||||
...res.data,
|
||||
remainingPrice
|
||||
};
|
||||
this.handleButtonStatus();
|
||||
remainingPrice,
|
||||
}
|
||||
this.handleButtonStatus()
|
||||
})
|
||||
.catch(err => {
|
||||
if (!err.msg) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 判断是否可以支付
|
||||
handleButtonStatus() {
|
||||
// 砍价按钮分为
|
||||
// 1.参与砍价 ==> 发起人与当前用户为同一人 && 未参与
|
||||
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 0) {
|
||||
this.participate = true;
|
||||
this.participate = true
|
||||
} else {
|
||||
this.participate = false;
|
||||
this.participate = false
|
||||
}
|
||||
|
||||
// 2.邀请好友 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额>0
|
||||
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price > 0) {
|
||||
this.inviteFriends = true;
|
||||
this.inviteFriends = true
|
||||
} else {
|
||||
this.inviteFriends = false;
|
||||
this.inviteFriends = false
|
||||
}
|
||||
|
||||
// 3.帮好友砍价 ==> 发起人与当前用户非一人 && 未参与未过期 && 剩余金额>0 && 为砍价
|
||||
@ -503,23 +489,23 @@ export default {
|
||||
// this.bargainHelpCount.userBargainStatus &&
|
||||
this.bargainHelpCount.price > 0
|
||||
) {
|
||||
this.helpFriendsBargain = true;
|
||||
this.helpFriendsBargain = true
|
||||
} else {
|
||||
this.helpFriendsBargain = false;
|
||||
this.helpFriendsBargain = false
|
||||
}
|
||||
|
||||
// 4.支付 ==> 发起人与当前用户同一人 && 已参与未过期 && 剩余金额<=0
|
||||
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price <= 0) {
|
||||
this.pay = true;
|
||||
this.pay = true
|
||||
} else {
|
||||
this.pay = false;
|
||||
this.pay = false
|
||||
}
|
||||
|
||||
// 5.砍价人发起新的砍价 ==> 发起人与当前用户非一人 && 未参与
|
||||
if (this.bargainUid != this.userInfo.uid) {
|
||||
this.bargain = true;
|
||||
this.bargain = true
|
||||
} else {
|
||||
this.bargain = false;
|
||||
this.bargain = false
|
||||
}
|
||||
|
||||
// 砍价弹窗
|
||||
@ -530,26 +516,26 @@ export default {
|
||||
// 获取开启砍价用户信息
|
||||
// 参与砍价,为同一人发起砍价后
|
||||
getBargainStartUser: function() {
|
||||
var that = this;
|
||||
var that = this
|
||||
getBargainStartUser({
|
||||
bargainId: that.bargainId,
|
||||
bargainUserUid: that.bargainUid
|
||||
bargainUserUid: that.bargainUid,
|
||||
})
|
||||
.then(res => {
|
||||
that.bargainUserInfo = res.data;
|
||||
that.getBargainHelpList();
|
||||
that.bargainUserInfo = res.data
|
||||
that.getBargainHelpList()
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭弹窗
|
||||
close: function() {
|
||||
this.active = false;
|
||||
this.active = false
|
||||
},
|
||||
// 设置微信分享
|
||||
onShareAppMessage: function() {
|
||||
@ -559,24 +545,24 @@ export default {
|
||||
path: 'pages/activity/DargainDetails/index?id=' + this.storeInfo.id + '&spread=' + uni.getStorageSync('uid'),
|
||||
success(res) {
|
||||
uni.showToast({
|
||||
title: '分享成功'
|
||||
});
|
||||
title: '分享成功',
|
||||
})
|
||||
},
|
||||
fail(res) {
|
||||
uni.showToast({
|
||||
title: '分享失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
icon: 'none',
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}`
|
||||
};
|
||||
path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}`,
|
||||
}
|
||||
};
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
@ -2,7 +2,7 @@
|
||||
<view class="page_box">
|
||||
<view class="content_box">
|
||||
<scroll-view class="scroll-box" scroll-y enable-back-to-top scroll-with-animation @scrolltolower="loadMore">
|
||||
<view class="group-wrap" :style="`background: url('${$VUE_APP_RESOURCES_URL}/images/index-bg.png') no-repeat;`">
|
||||
<view class="group-wrap" :style="{ background: background }">
|
||||
<view class="group-head x-bc">
|
||||
<text class="group-head__title">爆款拼团</text>
|
||||
<text class="group-head__notice">省钱省心限时拼</text>
|
||||
@ -63,7 +63,11 @@ export default {
|
||||
this.getGrouponList()
|
||||
},
|
||||
onPullDownRefresh() {},
|
||||
computed: {},
|
||||
computed: {
|
||||
background() {
|
||||
return `url('${this.$VUE_APP_RESOURCES_URL}/images/index-bg.png') no-repeat`
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 路由跳转
|
||||
jump(path, parmas) {
|
||||
|
@ -13,12 +13,7 @@
|
||||
</view>
|
||||
<view class="item acea-row row-between-wrapper">
|
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||
<button
|
||||
class="code font-color-red"
|
||||
:disabled="disabled"
|
||||
:class="disabled === true ? 'on' : ''"
|
||||
@click="code"
|
||||
>{{ text }}</button>
|
||||
<button class="code font-color-red" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="confirmBnt bg-color-red" @click="confirm">确认修改</view>
|
||||
@ -26,124 +21,115 @@
|
||||
</template>
|
||||
<style scoped lang="less">
|
||||
.ChangePassword .phone input {
|
||||
width: 2*100rpx;
|
||||
width: 2 * 100rpx;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
// import { mapGetters } from "vuex";
|
||||
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
||||
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
|
||||
import { validatorDefaultCatch } from "@/utils/dialog";
|
||||
import { registerReset, registerVerify, getUserInfo } from "@/api/user";
|
||||
import sendVerifyCode from '@/mixins/SendVerifyCode'
|
||||
import attrs, { required, alpha_num, chs_phone } from '@/utils/validate'
|
||||
import { validatorDefaultCatch } from '@/utils/dialog'
|
||||
import { registerReset, registerVerify, getUserInfo } from '@/api/user'
|
||||
|
||||
export default {
|
||||
name: "ChangePassword",
|
||||
name: 'ChangePassword',
|
||||
components: {},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
password: "",
|
||||
password2: "",
|
||||
captcha: "",
|
||||
phone: "", //隐藏几位数的手机号;
|
||||
yphone: "" //手机号;
|
||||
};
|
||||
password: '',
|
||||
password2: '',
|
||||
captcha: '',
|
||||
phone: '', //隐藏几位数的手机号;
|
||||
yphone: '', //手机号;
|
||||
}
|
||||
},
|
||||
mixins: [sendVerifyCode],
|
||||
// computed: mapGetters(["userInfo"]),
|
||||
mounted: function() {
|
||||
this.getUserInfo();
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
getUserInfo: function() {
|
||||
let that = this;
|
||||
let that = this
|
||||
getUserInfo().then(res => {
|
||||
that.yphone = res.data.phone;
|
||||
let reg = /^(\d{3})\d*(\d{4})$/;
|
||||
that.phone = that.yphone.replace(reg, "$1****$2");
|
||||
});
|
||||
that.yphone = res.data.phone
|
||||
let reg = /^(\d{3})\d*(\d{4})$/
|
||||
that.phone = that.yphone.replace(reg, '$1****$2')
|
||||
})
|
||||
},
|
||||
async confirm() {
|
||||
let that = this;
|
||||
const { password, password2, captcha } = that;
|
||||
let that = this
|
||||
const { password, password2, captcha } = that
|
||||
try {
|
||||
await that
|
||||
.$validator({
|
||||
password: [
|
||||
required(required.message("密码")),
|
||||
attrs.range([6, 16], attrs.range.message("密码")),
|
||||
alpha_num(alpha_num.message("密码"))
|
||||
],
|
||||
captcha: [
|
||||
required(required.message("验证码")),
|
||||
alpha_num(alpha_num.message("验证码"))
|
||||
]
|
||||
password: [required(required.message('密码')), attrs.range([6, 16], attrs.range.message('密码')), alpha_num(alpha_num.message('密码'))],
|
||||
captcha: [required(required.message('验证码')), alpha_num(alpha_num.message('验证码'))],
|
||||
})
|
||||
.validate({ password, captcha });
|
||||
.validate({ password, captcha })
|
||||
} catch (e) {
|
||||
return validatorDefaultCatch(e);
|
||||
return validatorDefaultCatch(e)
|
||||
}
|
||||
if (password !== password2) return uni.showToast({
|
||||
if (password !== password2)
|
||||
return uni.showToast({
|
||||
title: '两次密码不一致',
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
registerReset({
|
||||
account: that.yphone,
|
||||
captcha: that.captcha,
|
||||
password: that.password
|
||||
password: that.password,
|
||||
})
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
|
||||
// that.$yrouter.push({ path: "/pages/user/Login/index" });
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
async code() {
|
||||
let that = this;
|
||||
const { yphone } = that;
|
||||
let that = this
|
||||
const { yphone } = that
|
||||
try {
|
||||
await that
|
||||
.$validator({
|
||||
yphone: [
|
||||
required(required.message("手机号码")),
|
||||
chs_phone(chs_phone.message())
|
||||
]
|
||||
yphone: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
|
||||
})
|
||||
.validate({ yphone });
|
||||
.validate({ yphone })
|
||||
} catch (e) {
|
||||
return validatorDefaultCatch(e);
|
||||
return validatorDefaultCatch(e)
|
||||
}
|
||||
|
||||
registerVerify({ phone: yphone })
|
||||
.then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
that.sendCode();
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
that.sendCode()
|
||||
})
|
||||
.catch(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -128,7 +128,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
|
||||
import { getUserInfo, getMenuUser, bindingPhone } from '@/api/user'
|
||||
import { getUserInfo, getMenuUser, bindingPhone, wxappBindingPhone } from '@/api/user'
|
||||
import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils'
|
||||
import cookie from '@/utils/store/cookie'
|
||||
import SwitchWindow from '@/components/SwitchWindow'
|
||||
|
Reference in New Issue
Block a user