1.提交代码 更换登录api

yj-dev
杨杰 4 years ago
parent 33876e0857
commit f1f8726917
  1. 12
      App.vue
  2. 128
      components/Authorize.vue
  3. 13
      pages/goods/coupons-info-details/coupons-info-details.vue
  4. 117
      pages/goods/externalCoupon/externalCoupon.vue
  5. 157
      pages/goods/goods.vue
  6. 46
      pages/goods/store-list/store-details.vue
  7. 153
      pages/user/agentCoupons/agentCoupons.vue
  8. 8
      pages/user/minePromotion/minePromotion.vue

@ -1,17 +1,17 @@
<script>
export default {
globalData: {
url: 'http://192.168.3.4:9301/crest',
brestUrl: 'http://192.168.3.4:9302/brest',
imgUrl: 'https://192.168.3.4:9301/filesystem/',
// url: 'http://192.168.3.4:9301/crest',
// brestUrl: 'http://192.168.3.4:9302/brest',
// imgUrl: 'https://192.168.3.4:9301/filesystem/',
//
// url: 'https://hsg.dctpay.com/crest',
// imgUrl: 'https://hsg.dctpay.com/filesystem/',
// brestUrl : 'https://hsg.dctpay.com/brest',
//
// url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
url: 'https://hsgcs.dctpay.com/crest',
brestUrl : 'https://hsgcs.dctpay.com/brest',
imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
userInfo: "",
brestUserInfo : '',

@ -12,11 +12,11 @@
<!-- <button class='item grant' @click="setUserInfo">去授权</button> -->
<!-- #endif -->
<!-- #ifdef H5 -->
<button class='item grant' @click="setUserInfo">去授权</button>
<button class='item grant' @click="setUserInfo">去授权</button>
<!-- #endif -->
<!-- #ifdef MP -->
<button class='item grant' type="primary" open-type="getUserInfo" lang="zh_CN"
@getuserinfo="getuserinfo" withCredentials="true">去授权</button>
<button class='item grant' type="primary" @click="getuserinfo" lang="zh_CN"
withCredentials="true">去授权</button>
<!-- #endif -->
</view>
</view>
@ -57,70 +57,72 @@
},
getuserinfo() {
uni.showLoading({
title: '正在登录中'
});
// uni.showLoading({
// title: ''
// });
let that = this;
wx.login({
success(res) {
if (res.code) {
//
var code = res.code
//
uni.getUserInfo({
success: function(res) {
let params = {
openId: app.globalData.openId,
iv: res.iv,
encryptedData: res.encryptedData
}
getUserInfo(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
app.globalData.userInfo = res.return_data
.object
.highUser;
app.globalData.token = res.return_data.uniqueCode;
that.isShowAuth = false
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
uni.setStorage({
key: "token",
data: res.return_data.uniqueCode
})
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
} else {
uni.showToast({
title: res.return_msg
})
}
});
},
fail: res => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
} else {
fail: res => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
// wx.login({
// success(res) {
// if (res.code) {
//
// var code = res.code
//
uni.getUserProfile({
desc: '登录中...',
success: function(res) {
let params = {
openId: app.globalData.openId,
iv: res.iv,
encryptedData: res.encryptedData
}
getUserInfo(params).then(res => {
if (res.return_code == '000000') {
// uni.hideLoading();
app.globalData.userInfo = res.return_data
.object
.highUser;
app.globalData.token = res.return_data.uniqueCode;
that.isShowAuth = false
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
uni.setStorage({
key: "token",
data: res.return_data.uniqueCode
})
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
} else {
uni.showToast({
title: res.return_msg
})
}
}
});
},
fail: res => {
console.log('========' + JSON.stringify(res));
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
// } else {
// fail: res => {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// }
// })
that.isShowAuth = false
},
close() {
@ -136,7 +138,7 @@
button::after {
border: none
}
.Popup {
width: 600rpx;
background-color: #fff;

@ -27,7 +27,7 @@
<image class="coupon-qr" :src="imageUrl+'couponCode/'+couponDesInfo.highUserCoupon.qrCodeImg"></image>
</view>
<!-- <view class="width90 mart20" style="height: 80px;" v-for="(store,i) in storeList" :key="i">
<!-- <view class="width90 mart20" style="height: 80px;" v-for="(store,i) in storeList" :key="i">
<view class="coupon-des flleft">
立即<br>前往
</view>
@ -49,7 +49,9 @@
</template>
<script>
import { getCodeById } from "../../../Utils/Api.js";
import {
getCodeById
} from "../../../Utils/Api.js";
let app = getApp()
export default {
data() {
@ -68,6 +70,11 @@
this.couDesId = option.id;
this.getCodeById();
},
onUnload() {
let pages = getCurrentPages() //
let prePage = pages[pages.length - 2] //
prePage.$vm.reFreshs = Math.random()
},
filters: {
//
formatDate: function(value, spe = '/') {
@ -96,7 +103,7 @@
title: '加载中...'
})
let params = {
couponAgentCodeId: 8
couponAgentCodeId: this.couDesId
}
getCodeById(params).then(res => {
if (res.return_code == '000000') {

@ -14,8 +14,8 @@
</view>
</view>
<view class="line1 mart15"></view>
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" open-type="getUserInfo" lang="zh_CN"
@getuserinfo="getuserinfo" withCredentials="true">点击领取</button>
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN"
@click="getuserinfo" withCredentials="true">点击领取</button>
<button class="coupne-btn width60w mart20 marb20" v-else @click="receiveDiscount">点击领取</button>
<view class="width90 mart10 fcor666">去使用</view>
<view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666">
@ -186,79 +186,60 @@
},
//
getuserinfo() {
uni.showLoading({
title: '登录中...'
});
let that = this;
wx.login({
success(res) {
if (res.code) {
//
var code = res.code
//
uni.getUserInfo({
success: function(res) {
let params = {
openId: app.globalData.openId,
iv: res.iv,
encryptedData: res.encryptedData
}
getUserInfo(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
app.globalData.userInfo = res
.return_data
.object
.highUser;
app.globalData.token = res
.return_data.uniqueCode;
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
uni.setStorage({
key: "token",
data: res.return_data
.uniqueCode
})
that.receiveDiscount();
that.userInfo = 2;
} else {
uni.hideLoading();
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
});
},
fail: res => {
uni.hideLoading();
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
} else {
fail: res => {
// wx.login({
// success(res) {
// if (res.code) {
//
// var code = res.code
//
uni.getUserProfile({
desc: '登录中...',
success: function(res) {
let params = {
openId: app.globalData.openId,
iv: res.iv,
encryptedData: res.encryptedData
}
getUserInfo(params).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
app.globalData.userInfo = res
.return_data
.object
.highUser;
app.globalData.token = res
.return_data.uniqueCode;
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
uni.setStorage({
key: "token",
data: res.return_data
.uniqueCode
})
that.receiveDiscount();
that.userInfo = 2;
} else {
uni.hideLoading();
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
}
});
},
fail(res) {
uni.hideLoading();
fail: res => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
},
//
toGoods(e) {

File diff suppressed because one or more lines are too long

@ -24,8 +24,7 @@
<view class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="menCoupnList == '' && user != ''">
你还没有买券哦~
</view>
<button class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="user == '' " open-type="getUserInfo"
@getuserinfo="getuserinfo">
<button class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="user == '' " @click="getuserinfo">
点击授权查询个人卡券
</button>
@ -109,17 +108,18 @@
methods: {
//
getuserinfo() {
uni.showLoading({
title: '加载中...'
});
// uni.showLoading({
// title: '...'
// });
let that = this;
wx.login({
success(res) {
if (res.code) {
// wx.login({
// success(res) {
// if (res.code) {
//
var code = res.code
// var code = res.code
//
uni.getUserInfo({
uni.getUserProfile({
desc: '登录中...',
success: function(res) {
let params = {
openId: app.globalData.openId,
@ -167,19 +167,19 @@
}
})
} else {
fail: res => {
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
}
},
fail(res) {
uni.hideLoading();
}
})
// } else {
// fail: res => {
// uni.showToast({
// title: "",
// icon: "none"
// });
// }
// }
// },
// fail(res) {
// uni.hideLoading();
// }
// })
},
//

@ -1,46 +1,12 @@
<template>
<view>
<view class="width90 height120 backcorfff mart15">
<image class="flleft agent_img margle mart10" src='../../../static/img/logo.png'></image>
<view class="agent_title paddtop13">
<view class="font18 fcor333 width100">重庆中石化码商券</view>
<view class="width100 mart5 font14 fcor333 height22">
<view class="agent_left_num flleft">
42342424234234
</view>
<view class="agent_right_num flright fotrt">
300.00
</view>
</view>
</view>
<view class="width100 line1 mart5"></view>
<view class="width90">
<button class="flright backcorf06 fcorfff font15 agent_btn mart10" @click="generateCode">生成油码</button>
<view class="agent_ts font15 fcor333 fotrt">出售时间:2021.4.13 23:14</view>
</view>
</view>
<view class="width90 height120 backcorfff mart15">
<image class="flleft agent_img margle mart10" src='../../../static/img/logo.png'></image>
<view class="agent_title paddtop13">
<view class="font18 fcor333 width100">重庆中石化码商券</view>
<view class="width100 mart5 font14 fcor333 height22">
<view class="agent_left_num flleft">
42342424234234
</view>
<view class="agent_right_num flright fotrt">
300.00
</view>
</view>
</view>
<view class="width100 line1 mart5"></view>
<view class="width90">
<button class="flright backcorf06 fcorfff font15 agent_btn mart10">生成油码</button>
<view class="agent_ts font15 fcor333 fotrt">出售时间:2021.4.13 23:14</view>
<view class="onorder width90" v-if="agentCouponList.length==0">
<image src="../../../static/img/noorder.png"></image>
<view class="text">
暂无数据...
</view>
</view>
<view class="width90 height120 backcorfff mart15">
<view class="width90 height120 backcorfff mart15" v-for="(agent,index) in agentCouponList" :key="index">
<image class="flleft agent_img margle mart10" src='../../../static/img/logo.png'></image>
<view class="agent_title paddtop13">
<view class="font18 fcor333 width100">重庆中石化码商券</view>
@ -55,7 +21,10 @@
</view>
<view class="width100 line1 mart5"></view>
<view class="width90">
<button class="flright backcorf06 fcorfff font15 agent_btn mart10">生成油码</button>
<button class="flright backcorf06 fcorfff font15 agent_btn mart10" @click="generateCode(agent.id)"
v-if="typeId == 1">生成油码</button>
<button class="flright backcorf06 fcorfff font15 agent_btn mart10" @click="jumpCouponDes(agent.id)"
v-if="typeId == 2">查看详情</button>
<view class="agent_ts font15 fcor333 fotrt">出售时间:2021.4.13 23:14</view>
</view>
</view>
@ -70,42 +39,91 @@
export default {
data() {
return {
pageNum: 1,
pageSize: 10,
agentCouponList: [],
isNoMoreData: false,
typeId: '',
reFreshs: ""
}
},
onLoad() {
onLoad(option) {
this.typeId = option.id;
},
onShow() {
this.getCodeListByAgentCoupon();
},
watch: {
//reFresh,
reFreshs: function() {
this.pageNum = 1;
this.agentCouponList = []
this.isNoMoreData = false;
this.getCodeListByAgentCoupon();
}
},
methods: {
//
getCodeListByAgentCoupon() {
let datas = {
uni.showLoading({
title: '加载中...'
})
if (this.isNoMoreData) {
uni.hideLoading();
return false;
}
let pagenum = this.pageNum;
let params = {
pageNum: pagenum,
couponId: 23423529,
pageNum: 1,
pageSize: 10
status: this.typeId,
pageSize: this.pageSize
}
getCodeListByAgentCoupon(datas).then(res => {
if (res.return_code == '000000') {} else {
uni.showToast({
title: res.return_msg,
icon: "none"
})
getCodeListByAgentCoupon(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
if (res.return_data.total == (this.pageNum * this.pageSize)) {
this.isNoMoreData = true;
}
this.agentCouponList = this.agentCouponList.concat(res.return_data.list);
this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
} else {
this.agentCouponList = [];
}
})
},
//
generateCode() {
generateCode(item) {
uni.showLoading({
title: '油码生成中...'
})
let datas = {
couponAgentCodeId: 8
couponAgentCodeId: item
}
generateCode(datas).then(res => {
if (res.return_code == '000000') {} else {
uni.hideLoading()
if (res.return_code == '000000') {
uni.navigateTo({
url: '../../goods/coupons-info-details/coupons-info-details?id=1'
url: '../../goods/coupons-info-details/coupons-info-details?id=' + item
})
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
})
},
//
jumpCouponDes(ids) {
uni.navigateTo({
url: '../../goods/coupons-info-details/coupons-info-details?id=' + ids
})
}
}
}
</script>
@ -115,6 +133,31 @@
background-color: #f5f5f5;
}
.onorder {
width: 100%;
height: 50vw;
display: flex;
justify-content: center;
align-content: center;
flex-wrap: wrap;
image {
width: 20vw;
height: 20vw;
border-radius: 100%;
}
.text {
width: 100%;
height: 60upx;
font-size: 28upx;
color: #444;
display: flex;
justify-content: center;
align-items: center;
}
}
.agent_img {
width: 50px;
height: 50px;

@ -40,7 +40,7 @@
</view>
</view>
<!-- //:class="[index==0?'colorfe':'']" -->
<view v-for="(mers,index) in minepros" :key="mers.id" class="pro_mok marb10 colore7" @click="jumpAgent">
<view v-for="(mers,index) in minepros" :key="mers.id" class="pro_mok marb10 colore7" @click="jumpAgent(1)">
<view class="width100 font14 fcor333 fontwig6 fotct paddtop10">
面额100
</view>
@ -74,7 +74,7 @@
</view>
</view>
<!-- // -->
<view v-for="(mers,index) in minepros" :key="mers.id" class="pro_mok marb10 colore9" @click="jumpAgent">
<view v-for="(mers,index) in minepros" :key="mers.id" class="pro_mok marb10 colore9" @click="jumpAgent(2)">
<view class="width100 font14 fcor333 fontwig6 fotct paddtop10">
面额100
</view>
@ -124,9 +124,9 @@
})
},
//
jumpAgent() {
jumpAgent(item) {
uni.navigateTo({
url: '../agentCoupons/agentCoupons'
url: '../agentCoupons/agentCoupons?id='+item
})
}
}

Loading…
Cancel
Save