1.提交代码 更换登录api

yj-dev
杨杰 4 years ago
parent 33876e0857
commit f1f8726917
  1. 12
      App.vue
  2. 126
      components/Authorize.vue
  3. 13
      pages/goods/coupons-info-details/coupons-info-details.vue
  4. 117
      pages/goods/externalCoupon/externalCoupon.vue
  5. 155
      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> <script>
export default { export default {
globalData: { globalData: {
url: 'http://192.168.3.4:9301/crest', // url: 'http://192.168.3.4:9301/crest',
brestUrl: 'http://192.168.3.4:9302/brest', // brestUrl: 'http://192.168.3.4:9302/brest',
imgUrl: 'https://192.168.3.4:9301/filesystem/', // imgUrl: 'https://192.168.3.4:9301/filesystem/',
// //
// url: 'https://hsg.dctpay.com/crest', // url: 'https://hsg.dctpay.com/crest',
// imgUrl: 'https://hsg.dctpay.com/filesystem/', // imgUrl: 'https://hsg.dctpay.com/filesystem/',
// brestUrl : 'https://hsg.dctpay.com/brest', // brestUrl : 'https://hsg.dctpay.com/brest',
// //
// url: 'https://hsgcs.dctpay.com/crest', url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest', brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/', imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
userInfo: "", userInfo: "",
brestUserInfo : '', brestUserInfo : '',

@ -12,11 +12,11 @@
<!-- <button class='item grant' @click="setUserInfo">去授权</button> --> <!-- <button class='item grant' @click="setUserInfo">去授权</button> -->
<!-- #endif --> <!-- #endif -->
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<button class='item grant' @click="setUserInfo">去授权</button> <button class='item grant' @click="setUserInfo">去授权</button>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP --> <!-- #ifdef MP -->
<button class='item grant' type="primary" open-type="getUserInfo" lang="zh_CN" <button class='item grant' type="primary" @click="getuserinfo" lang="zh_CN"
@getuserinfo="getuserinfo" withCredentials="true">去授权</button> withCredentials="true">去授权</button>
<!-- #endif --> <!-- #endif -->
</view> </view>
</view> </view>
@ -57,70 +57,72 @@
}, },
getuserinfo() { getuserinfo() {
uni.showLoading({ // uni.showLoading({
title: '正在登录中' // title: ''
}); // });
let that = this; let that = this;
wx.login({ // wx.login({
success(res) { // success(res) {
if (res.code) { // if (res.code) {
// //
var code = res.code // var code = res.code
// //
uni.getUserInfo({ uni.getUserProfile({
success: function(res) { desc: '登录中...',
let params = { success: function(res) {
openId: app.globalData.openId, let params = {
iv: res.iv, openId: app.globalData.openId,
encryptedData: res.encryptedData iv: res.iv,
} encryptedData: res.encryptedData
getUserInfo(params).then(res => { }
if (res.return_code == '000000') { getUserInfo(params).then(res => {
uni.hideLoading(); if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data // uni.hideLoading();
.object app.globalData.userInfo = res.return_data
.highUser; .object
app.globalData.token = res.return_data.uniqueCode; .highUser;
that.isShowAuth = false app.globalData.token = res.return_data.uniqueCode;
uni.setStorage({ that.isShowAuth = false
key: "user", uni.setStorage({
data: res.return_data key: "user",
.object data: res.return_data
.highUser .object
}) .highUser
uni.setStorage({ })
key: "token", uni.setStorage({
data: res.return_data.uniqueCode key: "token",
}) data: res.return_data.uniqueCode
})
uni.reLaunch({
url: '/pages/tabBar/user/user' 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"
}); });
} 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 that.isShowAuth = false
}, },
close() { close() {

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

@ -14,8 +14,8 @@
</view> </view>
</view> </view>
<view class="line1 mart15"></view> <view class="line1 mart15"></view>
<button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" open-type="getUserInfo" lang="zh_CN" <button class="coupne-btn width60w mart20 marb20" v-if="userInfo == 1" lang="zh_CN"
@getuserinfo="getuserinfo" withCredentials="true">点击领取</button> @click="getuserinfo" withCredentials="true">点击领取</button>
<button class="coupne-btn width60w mart20 marb20" v-else @click="receiveDiscount">点击领取</button> <button class="coupne-btn width60w mart20 marb20" v-else @click="receiveDiscount">点击领取</button>
<view class="width90 mart10 fcor666">去使用</view> <view class="width90 mart10 fcor666">去使用</view>
<view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666"> <view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666">
@ -186,79 +186,60 @@
}, },
// //
getuserinfo() { getuserinfo() {
uni.showLoading({
title: '登录中...'
});
let that = this; let that = this;
wx.login({ // wx.login({
success(res) { // success(res) {
if (res.code) { // if (res.code) {
// //
var code = res.code // var code = res.code
// //
uni.getUserInfo({ uni.getUserProfile({
success: function(res) { desc: '登录中...',
let params = { success: function(res) {
openId: app.globalData.openId, let params = {
iv: res.iv, openId: app.globalData.openId,
encryptedData: res.encryptedData iv: res.iv,
} encryptedData: res.encryptedData
getUserInfo(params).then(res => { }
if (res.return_code == '000000') { getUserInfo(params).then(res => {
uni.hideLoading(); if (res.return_code == '000000') {
app.globalData.userInfo = res uni.hideLoading();
.return_data app.globalData.userInfo = res
.object .return_data
.highUser; .object
app.globalData.token = res .highUser;
.return_data.uniqueCode; app.globalData.token = res
uni.setStorage({ .return_data.uniqueCode;
key: "user", uni.setStorage({
data: res.return_data key: "user",
.object data: res.return_data
.highUser .object
}) .highUser
uni.setStorage({ })
key: "token", uni.setStorage({
data: res.return_data key: "token",
.uniqueCode data: res.return_data
}) .uniqueCode
that.receiveDiscount(); })
that.userInfo = 2; that.receiveDiscount();
} else { that.userInfo = 2;
uni.hideLoading(); } else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
})
}
});
},
fail: res => {
uni.hideLoading();
uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
}
})
} else {
fail: res => {
uni.hideLoading(); uni.hideLoading();
uni.showToast({ uni.showToast({
title: "微信登录授权失败", title: res.return_msg,
icon: "none" icon: 'none',
}); duration: 2000
})
} }
} });
}, },
fail(res) { fail: res => {
uni.hideLoading(); uni.showToast({
title: "微信登录授权失败",
icon: "none"
});
} }
}) })
}, },
// //
toGoods(e) { 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 class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="menCoupnList == '' && user != ''">
你还没有买券哦~ 你还没有买券哦~
</view> </view>
<button class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="user == '' " open-type="getUserInfo" <button class="store-no width80 fontwig6 font20 fcor999 fotct" v-if="user == '' " @click="getuserinfo">
@getuserinfo="getuserinfo">
点击授权查询个人卡券 点击授权查询个人卡券
</button> </button>
@ -109,17 +108,18 @@
methods: { methods: {
// //
getuserinfo() { getuserinfo() {
uni.showLoading({ // uni.showLoading({
title: '加载中...' // title: '...'
}); // });
let that = this; let that = this;
wx.login({ // wx.login({
success(res) { // success(res) {
if (res.code) { // if (res.code) {
// //
var code = res.code // var code = res.code
// //
uni.getUserInfo({ uni.getUserProfile({
desc: '登录中...',
success: function(res) { success: function(res) {
let params = { let params = {
openId: app.globalData.openId, openId: app.globalData.openId,
@ -167,19 +167,19 @@
} }
}) })
} else { // } else {
fail: res => { // fail: res => {
uni.showToast({ // uni.showToast({
title: "微信登录授权失败", // title: "",
icon: "none" // icon: "none"
}); // });
} // }
} // }
}, // },
fail(res) { // fail(res) {
uni.hideLoading(); // uni.hideLoading();
} // }
}) // })
}, },
// //

@ -1,46 +1,12 @@
<template> <template>
<view> <view>
<view class="width90 height120 backcorfff mart15"> <view class="onorder width90" v-if="agentCouponList.length==0">
<image class="flleft agent_img margle mart10" src='../../../static/img/logo.png'></image> <image src="../../../static/img/noorder.png"></image>
<view class="agent_title paddtop13"> <view class="text">
<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> </view>
</view> </view>
<view class="width90 height120 backcorfff mart15" v-for="(agent,index) in agentCouponList" :key="index">
<view class="width90 height120 backcorfff mart15">
<image class="flleft agent_img margle mart10" src='../../../static/img/logo.png'></image> <image class="flleft agent_img margle mart10" src='../../../static/img/logo.png'></image>
<view class="agent_title paddtop13"> <view class="agent_title paddtop13">
<view class="font18 fcor333 width100">重庆中石化码商券</view> <view class="font18 fcor333 width100">重庆中石化码商券</view>
@ -55,7 +21,10 @@
</view> </view>
<view class="width100 line1 mart5"></view> <view class="width100 line1 mart5"></view>
<view class="width90"> <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 class="agent_ts font15 fcor333 fotrt">出售时间:2021.4.13 23:14</view>
</view> </view>
</view> </view>
@ -70,42 +39,91 @@
export default { export default {
data() { data() {
return { return {
pageNum: 1,
pageSize: 10,
agentCouponList: [],
isNoMoreData: false,
typeId: '',
reFreshs: ""
} }
}, },
onLoad() {
onLoad(option) {
this.typeId = option.id;
},
onShow() {
this.getCodeListByAgentCoupon(); this.getCodeListByAgentCoupon();
}, },
watch: {
//reFresh,
reFreshs: function() {
this.pageNum = 1;
this.agentCouponList = []
this.isNoMoreData = false;
this.getCodeListByAgentCoupon();
}
},
methods: { methods: {
// //
getCodeListByAgentCoupon() { getCodeListByAgentCoupon() {
let datas = { uni.showLoading({
title: '加载中...'
})
if (this.isNoMoreData) {
uni.hideLoading();
return false;
}
let pagenum = this.pageNum;
let params = {
pageNum: pagenum,
couponId: 23423529, couponId: 23423529,
pageNum: 1, status: this.typeId,
pageSize: 10 pageSize: this.pageSize
} }
getCodeListByAgentCoupon(datas).then(res => { getCodeListByAgentCoupon(params).then(res => {
if (res.return_code == '000000') {} else { uni.hideLoading();
uni.showToast({ if (res.return_code == '000000') {
title: res.return_msg, this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
icon: "none" 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 = { let datas = {
couponAgentCodeId: 8 couponAgentCodeId: item
} }
generateCode(datas).then(res => { generateCode(datas).then(res => {
if (res.return_code == '000000') {} else { uni.hideLoading()
if (res.return_code == '000000') {
uni.navigateTo({ 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> </script>
@ -115,6 +133,31 @@
background-color: #f5f5f5; 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 { .agent_img {
width: 50px; width: 50px;
height: 50px; height: 50px;

@ -40,7 +40,7 @@
</view> </view>
</view> </view>
<!-- //:class="[index==0?'colorfe':'']" --> <!-- //: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"> <view class="width100 font14 fcor333 fontwig6 fotct paddtop10">
面额100 面额100
</view> </view>
@ -74,7 +74,7 @@
</view> </view>
</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"> <view class="width100 font14 fcor333 fontwig6 fotct paddtop10">
面额100 面额100
</view> </view>
@ -124,9 +124,9 @@
}) })
}, },
// //
jumpAgent() { jumpAgent(item) {
uni.navigateTo({ uni.navigateTo({
url: '../agentCoupons/agentCoupons' url: '../agentCoupons/agentCoupons?id='+item
}) })
} }
} }

Loading…
Cancel
Save