Browse Source

修改不兼容多平台的语法

zyh
Gao xiaosong 4 years ago
parent
commit
29459e76ca
  1. 314
      pages/activity/DargainDetails/index.vue
  2. 8
      pages/activity/GoodsGroup/index.vue
  3. 118
      pages/user/ChangePassword/index.vue
  4. 2
      pages/user/User/index.vue

314
pages/activity/DargainDetails/index.vue

@ -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">
@ -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) {
// urluiduid
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">

8
pages/activity/GoodsGroup/index.vue

@ -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) {

118
pages/user/ChangePassword/index.vue

@ -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>
@ -32,118 +27,109 @@
</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>

2
pages/user/User/index.vue

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

Loading…
Cancel
Save