Commit 6f616850 authored by liwei's avatar liwei

修改了登录、我的、报名页面

parent 62068d95
...@@ -16,3 +16,13 @@ export function activityDetail(id) { ...@@ -16,3 +16,13 @@ export function activityDetail(id) {
method: 'GET', method: 'GET',
}) })
} }
//报名
export function addApplication(data) {
return request({
url:'/cmsApplication/add',
method: 'POST',
data
})
}
import {request} from '../../util/api' import {request} from '../../util/api'
//请求接口路径
const apis = {
getUserInfo: "/suituser/getInfo",
login: "/wxMiniApp/validLogin",
phoneLogin: "/wxMiniApp/phoneLogin",
};
export function getUserInfo(data){ /**
* 设置授权信息
*/
export function setUserProfile(data){
return request({ return request({
url: apis.getUserInfo, url: "/app/wxMiniApp/saveUserProfile?nickName="+data.nickName+"&avatarUrl="+data.avatarUrl+"&gender="+data.gender+"&address="+data.address,
method: "get", method: "post",
}); });
}; };
// 第一次登录接口 /**
* 登录
*/
export function login(data){ export function login(data){
return request({ return request({
url: apis.login, url: "/app/wxMiniApp/validLogin",
method: "get", method: "get",
needToken: false, needToken: false,
data, data,
}); });
}; };
// 手机号登录接口 /**
* 手机号登录
*/
export function phoneLogin(data){ export function phoneLogin(data){
return request({ return request({
method: "get", method: "get",
url: '/wxMiniApp/phoneLogin?encryptedData='+data.encryptedData+'&iv='+data.iv+'&openId='+data.openId, url: '/app/wxMiniApp/phoneLogin?encryptedData='+data.encryptedData+'&iv='+data.iv+'&openId='+data.openId,
needToken: false, needToken: false,
}); });
} }
// 根据字典类型查询字典数据信息
export function getDicts(params) {
return request({
url: '/system/dict/data/list',
params: params,
method: 'get'
})
}
//获取公共文化
export function getPublicActivity(query){
return request({
url: '/system/activity/getPublicActivity',
method: 'get'
})
}
// 获取个人信息
export function getInfo(id) {
return request({
url: '/sysUserManage/memberDetail/' + id,
method: 'get'
})
}
// 应用全局配置 // 应用全局配置
module.exports = { module.exports = {
baseUrl: 'http://localhost:8082' baseUrl: 'http://localhost:8092'
} }
// module.exports = { // module.exports = {
// devServer: { // devServer: {
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
<!-- 使用z-paging-swiper为根节点可以免计算高度 --> <!-- 使用z-paging-swiper为根节点可以免计算高度 -->
<z-paging-swiper> <z-paging-swiper>
<view :class="['add',isOpen?'add2':'']"> <view :class="['add',isOpen?'add2':'']">
<image @click='goPage("/pagescommunity/newsRelease/newsRelease")' src="../../static/images/102.png" mode=""> <image @click='goPage("/pagescommunity/newsRelease/newsRelease")' src="../../static/images/102.png" mode=""/>
</image>
</view> </view>
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中 --> <!-- 需要固定在顶部不滚动的view放在slot="top"的view中 -->
<!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 --> <!-- 注意!此处的z-tabs为独立的组件,可替换为第三方的tabs,若需要使用z-tabs,请在插件市场搜索z-tabs并引入,否则会报插件找不到的错误 -->
......
...@@ -165,10 +165,10 @@ ...@@ -165,10 +165,10 @@
</view> </view>
</view> </view>
<!-- 授权弹窗-->
<u-popup u-popup :show="tipsShow" mode="center" round="12" :safeAreaInsetBottom="false"> <u-popup u-popup :show="tipsShow" mode="center" round="12" :safeAreaInsetBottom="false">
<view class="popup-container"> <view class="popup-container">
<image class="pop-bgc" :src="img + '/img/home-pop-bg.png'"></image> <image class="pop-bgc" src="../../static/images/me/home-pop-bg.png"></image>
<view class="div-popo"> <view class="div-popo">
<view class="pop-title">温馨提示</view> <view class="pop-title">温馨提示</view>
<view class="tips-content"> <view class="tips-content">
...@@ -185,14 +185,16 @@ ...@@ -185,14 +185,16 @@
</view> </view>
</u-popup> </u-popup>
</view> </view>
</template> </template>
<script> <script>
import {setUserProfile} from '../../api/login/index'
export default { export default {
data() { data() {
return { return {
tipsShow:false, tipsShow:false,//授权弹窗
nologin: '', nologin: '',//登录标志
userInfo:{},//用户信息
token:'',//token
img: this.$BASE_URL, img: this.$BASE_URL,
bgColor: "rgba(255, 255, 255, 0)", bgColor: "rgba(255, 255, 255, 0)",
button: [ button: [
...@@ -226,24 +228,27 @@ ...@@ -226,24 +228,27 @@
} }
}, },
numtwo: 0, numtwo: 0,
ownerId: null,
timeoutObj: null,
socketTask: null,
tipMsg: "" tipMsg: ""
}; };
}, },
onShow() { onShow(){
if (uni.getStorageSync('token')) {
this.ownerId = uni.getStorageSync('info') != null ? uni.getStorageSync('info').id : null;
}
if (uni.getStorageSync('userInfo')) {
this.nologin = false this.nologin = false
this.userInfo = uni.getStorageSync('userInfo')
this.token = uni.getStorageSync('token')
if (this.token && this.token != null && this.token !== ''){
//token存在,证明已登录
//判断授权
if (this.userInfo && this.userInfo.wxNickName !== '' && this.userInfo.wxNickName != null) {
//已授权过
this.tipsShow = false
} else { } else {
//没授权过,需要授权
this.tipsShow = true
}
} else {
//token不存在,未登录,跳转到登录页面进行登录
this.nologin = true this.nologin = true
} }
},
onHide() {
}, },
methods: { methods: {
//获取用户信息 //获取用户信息
...@@ -252,19 +257,39 @@ ...@@ -252,19 +257,39 @@
wx.getUserProfile({ wx.getUserProfile({
desc: '用于完善会员资料', desc: '用于完善会员资料',
success: res => { success: res => {
console.log('userInfo========:',res) const params = {
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl,
gender: res.userInfo.gender,
address: res.userInfo.country + res.userInfo.province + res.userInfo.city,//国家+省份+城市
}
setUserProfile(params).then(res => {
uni.setStorageSync('userInfo', res.data.data)
}).catch(err => {
console.log('err:',err)
})
}, },
fail: errinfo => { fail: errinfo => {
console.log('errinfo1==========',errinfo) console.log('授权失败,请稍后再试',errinfo)
} }
}); });
} catch { } catch {
wx.getUserInfo({ wx.getUserInfo({
success: resinfo => { success: res => {
const params = {
nickName: res.userInfo.nickName,
avatarUrl: res.userInfo.avatarUrl,
gender: res.userInfo.gender,
address: res.userInfo.country + res.userInfo.province + res.userInfo.city,//国家+省份+城市
}
setUserProfile(params).then(res => {
uni.setStorageSync('userInfo', res.data.data)
}).catch(err => {
console.log('err:',err)
})
}, },
fail: errinfo => { fail: errinfo => {
console.log('errinfo2==========',errinfo) console.log('授权失败,请稍后再试',errinfo)
} }
}); });
} }
...@@ -272,6 +297,9 @@ ...@@ -272,6 +297,9 @@
//不同意授权 //不同意授权
handleNoAgree() { handleNoAgree() {
this.tipsShow = false; this.tipsShow = false;
uni.switchTab({
url: '/pages/tab/index'
});
}, },
//同意授权 //同意授权
handAgree() { handAgree() {
...@@ -284,13 +312,11 @@ ...@@ -284,13 +312,11 @@
}) })
}, },
gotolike(type) { //喜欢三个列表页面 gotolike(type) { //喜欢三个列表页面
this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询";
this.$refs.elm.showDialog();
}, },
whether(i) { whether(i) {
if (i == 0) { if (i == 0) {
this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询"; this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询";
this.$refs.elm.showDialog();
} else if (i == 1) { } else if (i == 1) {
this.updateInformation(); this.updateInformation();
} else if (i == 3) { } else if (i == 3) {
...@@ -314,8 +340,7 @@ ...@@ -314,8 +340,7 @@
}) })
}, },
goCommunity(){ goCommunity(){
this.tipMsg = "开源版暂未开放,敬请期待!如需旗舰版,可联系作者微信(MMRWXM)咨询";
this.$refs.elm.showDialog();
}, },
} }
...@@ -346,16 +371,7 @@ ...@@ -346,16 +371,7 @@
image{ image{
width: calc(33% - 10rpx); width: calc(33% - 10rpx);
height: 198rpx; height: 198rpx;
// border: 1rpx solid #707070;
border-radius: 12rpx; border-radius: 12rpx;
// &:first-child{
// border-bottom-left-radius: 12rpx;
// border-top-left-radius:12rpx;
// }
// &:last-child{
// border-bottom-right-radius: 12rpx;
// border-top-right-radius:12rpx;
// }
} }
} }
.strs{ .strs{
...@@ -396,8 +412,6 @@ ...@@ -396,8 +412,6 @@
.box-bottom-text { .box-bottom-text {
font-size: 28rpx; font-size: 28rpx;
// font-family: 'PingFang SC-Heavy, PingFang SC';
// font-weight: 400;
font-family: 'PingFang SC-Heavy'; font-family: 'PingFang SC-Heavy';
font-weight: bolder; font-weight: bolder;
color: rgba(45, 49, 50, 0.9); color: rgba(45, 49, 50, 0.9);
...@@ -471,16 +485,6 @@ ...@@ -471,16 +485,6 @@
margin-left: 14rpx; margin-left: 14rpx;
} }
// .boxsname {
// height: 42rpx;
// font-size: 28rpx;
// font-family: 'PingFang SC-Heavy, PingFang SC';
// color: rgba(45, 49, 50, 0.9);
// font-weight: 400;
// line-height: 42rpx;
// margin-left: 14rpx;
// }
.boxsing { .boxsing {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -555,7 +559,6 @@ ...@@ -555,7 +559,6 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 50rpx; margin-top: 50rpx;
} }
.sss { .sss {
...@@ -669,7 +672,6 @@ ...@@ -669,7 +672,6 @@
background: linear-gradient(180deg, #F4F5F9 0%, #F4F5F9 100%); background: linear-gradient(180deg, #F4F5F9 0%, #F4F5F9 100%);
} }
.bgc-img { .bgc-img {
position: absolute; position: absolute;
top: -80rpx; top: -80rpx;
...@@ -695,4 +697,67 @@ ...@@ -695,4 +697,67 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.popup-container {
height: 562rpx;
width: 544rpx;
overflow: hidden;
.div-popo {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
.pop-title {
color: rgba(45, 49, 50, 0.8);
font-size: 40rpx;
font-family: 'PingFang SC-Heavy, PingFang SC';
display: flex;
justify-content: center;
margin-top: 50rpx;
}
.tips-content {
width: 448rpx;
margin: auto;
text-align: left;
margin-top: 50rpx;
line-height: 56rpx;
color: #666;
font-size: 28rpx;
font-family: 'PingFang SC-Regular, PingFang SC';
.agreement-btn {
display: inline-block;
color: #5b83e8;
font-family: 'PingFang SC-Bold, PingFang SC';
text-decoration: underline;
}
}
.btn-c {
display: flex;
margin: auto;
margin-top: 64rpx;
justify-content: space-between;
width: 428rpx;
}
}
.pop-btn {
width: 204rpx;
height: 76rpx;
border-radius: 38rpx;
text-align: center;
line-height: 76rpx;
border: 2rpx solid #446cd2;
color: #5b83e8;
font-family: 'PingFang SC-Regular, PingFang SC';
&.agree {
border: none;
background: linear-gradient(86deg, #c2d2f9 0%, #c5c2f3 100%);
}
}
}
</style> </style>
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<view class="act-detail" v-html="activityDetail.details"> <view class="act-detail" v-html="activityDetail.details">
</view> </view>
</view> </view>
<view class="act-bottom" v-if="type!=='1'"> <view class="act-bottom">
<view class="act-button" @click="open(activityDetail)">报名</view> <view class="act-button" @click="open">报名</view>
</view> </view>
</view> </view>
<!-- 报名弹窗 --> <!-- 报名弹窗 -->
...@@ -25,34 +25,19 @@ ...@@ -25,34 +25,19 @@
<view class="popbod-title">{{activityDetail.title}}</view> <view class="popbod-title">{{activityDetail.title}}</view>
<view class="pop-time"> <view class="pop-time">
<image class="poptime-img" src="../../static/images/activity/date.png"/> <image class="poptime-img" src="../../static/images/activity/date.png"/>
<view class="poptime-text">{{activityDetail.createDate}}</view> <view class="poptime-text">{{activityDetail.startTime}}</view>
</view> </view>
<view class="pop-price"> <view class="pop-price">
<image class="popprice-img" src="../../static/images/activity/unitPrice.png"/> <image class="popprice-img" src="../../static/images/activity/unitPrice.png"/>
<view class="popprice-text">单价:<text>{{activityDetail.registrationFee}}次/人</text></view> <view class="popprice-text">单价:<text>{{activityDetail.applicationFee}}次/人</text></view>
</view> </view>
</view> </view>
</view> </view>
<view class="buy-num"> <view class="buy-num">
<view class="buynum-title">购买数量</view> <view class="buynum-title">购买数量</view>
<view class="buynum-math"> <view class="buynum-math">
<image class="reduce" :src="baseURL+'static/images/减.png'" @click="reduce"/>
<view class="num">{{buynum}}</view> <view class="num">{{buynum}}</view>
<image class="add" :src="baseURL+'static/images/加.png'" @click="add"/>
</view>
</view>
<view class="usecoupon">
<view class="usecoupon-title">优惠券</view>
<view class="usecoupon-click" v-if="availablenum != 0 && discountamount==0"
@click="openavailablecoupon">
<text>{{availablenum}}</text>张可用
</view>
<view class="usecoupon-click" v-else-if="discountamount!==0" @click="openavailablecoupon">
-¥{{discountamount}}
</view>
<view class="usecoupon-click" v-else>
暂无可用优惠券
</view> </view>
</view> </view>
<view class="all-price"> <view class="all-price">
...@@ -61,85 +46,19 @@ ...@@ -61,85 +46,19 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<!-- 优惠券详情 -->
<u-popup :show="show1" @close="close1" round="40">
<view class="couponpopup">
<view class="couponpopup-title">优惠券</view>
<view style="max-height: 50vh;overflow-y: scroll;">
<view class="coupon" v-for="item in couponList">
<view class="coupon-price" v-if="item.type === 0">
<text style="margin-top: 30rpx;"></text><text
style="font-size: 64rpx;">{{item.amount}}</text>
</view>
<view class="coupon-price" v-if="item.type === 1">
<text style="font-size: 64rpx;">{{item.discount}}</text><text
style="margin-top: 30rpx;"></text>
</view>
<view class="coupon-message">
<view class="message-left">
<view class="preferential">{{item.name}}</view>
<view class="preferential-time" v-if="item.useType === 1">
{{ dateFormat(item.useEndTime) }}前可用
</view>
<view class="preferential-time" v-else>领取后{{item.limitTime}}天内有效</view>
</view>
<view class="message-right">
<view class="right-button" @click="receive(item)">领取</view>
</view>
</view>
</view>
</view>
</view>
</u-popup>
<!-- 可用优惠券弹窗 -->
<u-popup :show="show2" @close="close2" round="40">
<view class="couponpopup">
<view class="couponpopup-title">可使用优惠券</view>
<u-radio-group v-model="radiovalue1" placement="column" iconPlacement="right" size="36">
<u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in availablecouponList"
:key="index" :label="item.name" :name="item.businessId" label-size="36" size="36"
activeColor="#D84848" @change="changecoupon(item)">
</u-radio>
</u-radio-group>
<view class="couponpopup-button">
<view class="all-button" @click="cancel">取消</view>
<view class="all-button" @click="submit(item)">确定</view>
</view>
</view>
</u-popup>
<!-- 是否使用折扣券弹出框 -->
<u-modal :show="show3" @confirm="confirm" ref="uModal" :content="content" :showCancelButton="true"
@cancel="usecancel"></u-modal>
</view> </view>
</template> </template>
<script> <script>
import {activityDetail} from "../../api/activity/index.js" import {activityDetail,addApplication} from "../../api/activity/index.js"
export default { export default {
data() { data() {
return { return {
baseURL: 'http://localhost:8088/idea/file/',
show: false, //报名弹窗 show: false, //报名弹窗
show1: false, // 是否显示优惠券弹窗
show2: false, // 是否显示可用优惠券弹窗
show3: false, //是否使用折扣券弹出框
activityDetail: {},//活动详情 activityDetail: {},//活动详情
type: '',
businessActivityDetail: {}, //活动详情
couponList: [], //优惠券列表
coupon: {}, // 商家活动显示的优惠券数据
activityId: '', // 活动id activityId: '', // 活动id
buynum: 1, // 购买数量 buynum: 1, // 购买数量
totalprice: 0, //总价 totalprice: 0, //总价
availablenum: 0, // 可用优惠券的数量
availablecouponList: [], // 可用优惠券列表
radiovalue1: '',
couponname: '', // 优惠券名称
couponid: '', // 优惠券id
discountamount: 0, // 优惠金额
content: '', //优惠券折扣
memberdiscount: 1, //会员折扣
couponvalue: {}
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -157,163 +76,44 @@ ...@@ -157,163 +76,44 @@
'<img style="max-width:100%;height:auto;border-radius: 12px 12px 12px 12px;" ') '<img style="max-width:100%;height:auto;border-radius: 12px 12px 12px 12px;" ')
}) })
}, },
// 领取优惠券
receive(row) {
claimcoupons(row.businessId).then(res => {
if (res.code === 200) {
uni.showToast({
title: '领取成功',
icon: 'success'
})
this.show1 = false
this.getCouponList()
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
// 查询已领取优惠券
getReceivedcoupon() {
const params = {
activityId: this.activityId,
num: this.buynum
}
receivedcoupon(params).then(res => {
console.log("已领取优惠券", res)
this.availablenum = res.total
this.availablecouponList = res.rows
})
},
// 查询优惠券列表
getCouponList() {
const query = {
storeId: this.id
}
couponList(query).then(res => {
console.log("优惠券列表", res)
this.couponList = res.rows
this.coupon = res.rows[0]
})
},
// 打开优惠券弹窗
opencoupon() {
this.show1 = true
},
// 打开报名弹窗 // 打开报名弹窗
open(data) { open() {
const token = uni.getStorageSync('token')
//校验token 如果没有token,跳到登录页进行登录
if (token && token !== '' && token != null){
this.show = true this.show = true
this.businessActivityDetail = data
this.activityId = data.businessId
this.getReceivedcoupon()
this.getMemberdiscount()
this.countprice() this.countprice()
},
// 查询会员折扣
getMemberdiscount() {
memberdiscount().then(res => {
console.log("会员折扣", res)
if (res.data !== 100) {
const num1 = '0.' + res.data // 会员折扣
this.memberdiscount = parseFloat(num1)
this.memberdiscount = this.memberdiscount.toFixed(2)
} else { } else {
this.memberdiscount = 1 uni.navigateTo({
} url: '/pageslogin/index/index'
console.log("会员折扣的值", this.memberdiscount)
}) })
}, }
// 打开可使用优惠券的弹窗
openavailablecoupon() {
this.show = false
this.show2 = true
this.discountamount = 0
}, },
// 可使用优惠券弹窗取消按钮 // 可使用优惠券弹窗取消按钮
cancel() { cancel() {
this.show = true this.show = true
this.show2 = false
this.discountamount = 0
this.radiovalue1 = ''
}, },
// 可使用优惠券弹窗提交按钮 // 可使用优惠券弹窗提交按钮
submit(preson) { submit(preson) {
this.show = true this.show = true
this.show2 = false
this.countprice() this.countprice()
}, },
// 提交订单 // 提交订单
submitorder() { submitorder() {
const ordermessage = { const applyParams = {
goodsId: this.activityId, activityId: this.activityDetail.businessId,
num: this.buynum, status:'1',
couponId: this.couponid, applicationFee:this.totalprice,
type: this.businessActivityDetail.activityType }
} // 添加订单(报名)
// 添加订单 addApplication(applyParams).then(res => {
addorder(ordermessage).then(res => { if (res.data.code === 200) {
console.log('添加订单', res) this.show = false
const activityId = this.activityId
if (res.code === 200) {
const orderid = res.data.businessId
// 支付
const payquery = {
orderId: orderid,
activityId: this.activityId
}
pay(payquery).then(res => {
console.log("测试支付", res)
if (res.errMsg === 'OK') {
if (!res.data.nonceStr) {
uni.showToast({
title: '下单失败,请稍后重试',
icon: 'none'
})
} else {
uni.requestPayment({
provider: "wxpay",
appId: res.data.appid, // 微信小程序appid
timeStamp: res.data.timeStamp, // 时间戳
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package,
signType: "MD5", // 签名算法
paySign: res.data.paySign, // 签名
success(res) {
uni.showToast({ uni.showToast({
title: '支付成功', title: '报名成功',
icon: 'success' icon: 'success'
}) })
uni.navigateTo({ } else if(res.data.code !== 200){
url:'/pages/mine/myorder/index'
})
},
fail(e) {
uni.showToast({
title: '支付已取消',
icon: 'none'
})
// const activityId = this.activityId
const orderStatus = {
orderId: orderid,
activityId: activityId
}
// 修改订单状态为待支付
updateorderstatus(orderStatus).then(res=>{
console.log('修改订单状态',res)
})
}
});
}
} else {
uni.showToast({
title: '下单失败',
icon: 'none'
})
}
})
} else if(res.code !== 200){
console.log("到这") console.log("到这")
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -322,69 +122,15 @@ ...@@ -322,69 +122,15 @@
} }
}) })
}, },
// 选择优惠券
changecoupon(value) {
console.log("数据===", value)
this.couponvalue = value
this.couponname = value.name
this.couponid = value.businessId
if (value.type === 0) {
this.discountamount = value.amount
} else if (value.type === 1) {
this.show2 = false
this.show3 = true
this.content = '会员折扣和优惠券折扣不能同时享用,是否确认使用该折扣券?'
}
},
// 确认按钮,若用户点击确认,则使用优惠券折扣
confirm() {
this.show2 = true
this.show3 = false
const num = '0.' + this.couponvalue.discount
const num1 = parseFloat(num)
// const num2 = num1.toFixed(2)
const num2 = (1 - num1) * this.totalprice
this.discountamount = num2.toFixed(2)
},
// 取消按钮,若用户点击取消,则使用会员折扣
usecancel() {
this.show3 = false
this.cancel()
},
// 计算总价 // 计算总价
countprice() { countprice() {
const price1 = this.businessActivityDetail.price * this.buynum - this.discountamount // 满减券优惠后的总金额 const price1 = this.activityDetail.applicationFee * this.buynum
this.totalprice = price1 * this.memberdiscount this.totalprice = price1
console.log("总价钱", this.totalprice)
}, },
// 关闭报名弹窗 // 关闭报名弹窗
close() { close() {
this.show = false this.show = false
}, },
// 关闭优惠券弹窗
close1() {
this.show1 = false
},
// 关闭可使用优惠券弹窗
close2() {
this.show2 = false
},
// 加购买数量
add() {
this.buynum = this.buynum + 1
this.getReceivedcoupon()
this.countprice()
},
// 减购买数量
reduce() {
this.buynum = this.buynum - 1
if (this.buynum < 1) {
this.buynum = 1
}
this.getReceivedcoupon()
this.countprice()
}
} }
} }
</script> </script>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
openId: '', openId: '',
}; };
}, },
async created() { created() {
// 获取openId // 获取openId
this.usersLogin().catch(res => { this.usersLogin().catch(res => {
console.log("登录错误信息", res) console.log("登录错误信息", res)
...@@ -35,9 +35,6 @@ ...@@ -35,9 +35,6 @@
// 关闭加载 // 关闭加载
uni.hideLoading() uni.hideLoading()
}) })
},
onShow() {
}, },
methods: { methods: {
/** /**
...@@ -63,7 +60,7 @@ ...@@ -63,7 +60,7 @@
this.openId = res.data.data.wxOpenid this.openId = res.data.data.wxOpenid
this.userInfo = res.data.data this.userInfo = res.data.data
uni.setStorageSync('token', this.token) uni.setStorageSync('token', this.token)
uni.setStorageSync('userInfo', JSON.stringify(this.userInfo)) uni.setStorageSync('userInfo', this.userInfo)
//停止加载 //停止加载
uni.hideLoading() uni.hideLoading()
uni.switchTab({ uni.switchTab({
...@@ -144,7 +141,6 @@ ...@@ -144,7 +141,6 @@
// 判断是否获取到token // 判断是否获取到token
if (this.token) { if (this.token) {
console.log('3333')
uni.hideLoading(); uni.hideLoading();
uni.switchTab({ uni.switchTab({
url: '/pages/tab/index' url: '/pages/tab/index'
......
...@@ -4,7 +4,6 @@ import config from '@/config' ...@@ -4,7 +4,6 @@ import config from '@/config'
// #endif // #endif
// #ifndef H5 // #ifndef H5
// 请求接口 // 请求接口
//export const BASE_URL = 'https://www.wxmblog.com/wxmapi'; //正式接口
export const BASE_URL = config.baseUrl; export const BASE_URL = config.baseUrl;
// #endif // #endif
...@@ -28,9 +27,9 @@ export const request = (options) => { ...@@ -28,9 +27,9 @@ export const request = (options) => {
method: options.method || "GET", method: options.method || "GET",
data: options.data || {}, data: options.data || {},
dataType: 'json', dataType: 'json',
// header: { header: {
// Authorization:options.withToken? uni.getStorageSync("token"):'', Authorization:'Bearer '+ uni.getStorageSync("token"),
// }, },
success: (res) => { success: (res) => {
// if (res.data.code == 2) { // if (res.data.code == 2) {
// uni.showToast({ // uni.showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment