瀏覽代碼

[授权的修改][修改]:[]

tags/福建版C.9.1.01
meo 5 年之前
父節點
當前提交
fe603c7449
共有 8 個檔案被更改,包括 197 行新增196 行删除
  1. +20
    -35
      pages/coupon/detail/index.js
  2. +1
    -0
      pages/getphoneInfo/index.js
  3. +25
    -2
      pages/getuserinfo/index.js
  4. +1
    -1
      pages/getuserinfo/index.wxml
  5. +4
    -4
      pages/index/index.js
  6. +141
    -135
      pages/spellGroup/mySpellGroup/index.js
  7. +5
    -2
      pages/spellGroup/mySpellGroup/index.wxss
  8. +0
    -17
      pages/spellGroup/spellGroup.js

+ 20
- 35
pages/coupon/detail/index.js 查看文件

@@ -101,7 +101,6 @@ Page({
isshowposter: false, isshowposter: false,
}) })
}, },
/** /**
* 显示分享海报 * 显示分享海报
*/ */
@@ -590,46 +589,18 @@ Page({
} }
}) })
}, },
checkPhoneStatus: function() {
let that = this;
Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
console.log(666, '授权成功!')
that.receiveCard()
})
.catch(err => {
if (err.code == 11005) {
/**
* 手机号没有授权,将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate,
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate,
});
} else {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
}
})
},
/** /**
* 发起支付 * 发起支付
*/ */
orderFunc(discount) { orderFunc(discount) {
let that = this; let that = this;
Http.get({ Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus, url: config.api.checkPhoneStatus,
data: {} data: {}
}) })
@@ -854,6 +825,20 @@ Page({
} }
} }
}) })
}).catch(err => {
console.log(err)
if(err.code == 11004){
wx.redirectTo({
url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`,
})
}else{
wx.showToast({
title: err.message,
icon:"none",
duration:2500
})
}
})
}, },
// 获得未支付的订单 // 获得未支付的订单
getUnPaidOrder(couponId){ getUnPaidOrder(couponId){


+ 1
- 0
pages/getphoneInfo/index.js 查看文件

@@ -25,6 +25,7 @@ Page({
couponChannelId: options.couponChannelId couponChannelId: options.couponChannelId
}); });
} }

if (options && options.mineFlag) { if (options && options.mineFlag) {
that.setData({ that.setData({
mineFlag: options.mineFlag mineFlag: options.mineFlag


+ 25
- 2
pages/getuserinfo/index.js 查看文件

@@ -11,10 +11,25 @@ Page({
cuserId:null, cuserId:null,
coverImg:null, coverImg:null,
couponOrderId:null, couponOrderId:null,
optionData:null
optionData:null,
fromflag:'',
couponChannelIdflag:''
}, },
onLoad: function(options) { onLoad: function(options) {
var that = this; var that = this;
// options.fromflag == 'coupondetail';
// 来自优惠券详情页面
if (options && options.fromflag){
that.setData({
fromflag: options.fromflag
})
}
// 来自优惠券列表券详情页面的 couponChannelId
if (options && options.couponChannelIdflag) {
that.setData({
couponChannelIdflag: options.couponChannelIdflag
})
}
if (options && options.spellGroup){ if (options && options.spellGroup){
that.setData({ that.setData({
spellGroup: options.spellGroup spellGroup: options.spellGroup
@@ -256,7 +271,15 @@ Page({
wx.switchTab({ wx.switchTab({
url: '/index/searchbar' url: '/index/searchbar'
}); });
} else {
} else if (that.data.fromflag == 'coupondetail' && that.data.couponChannelIdflag){
wx.navigateTo({
url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelIdflag}`
});
} else if (that.data.fromflag == 'spellcoupondetail' && that.data.couponChannelIdflag) {
wx.navigateTo({
url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelIdflag}`
});
}else {
wx.switchTab({ wx.switchTab({
url: "/index/index" url: "/index/index"
}); });


+ 1
- 1
pages/getuserinfo/index.wxml 查看文件

@@ -1,4 +1,4 @@
<navbar text="微信授权"></navbar>
<navbar home text="微信授权"></navbar>
<view class="login-body" style="padding-top:200rpx;"> <view class="login-body" style="padding-top:200rpx;">
<view class="login-logo"> <view class="login-logo">
<image src="{{mallImgUrl}}" mode='widthFix'></image> <image src="{{mallImgUrl}}" mode='widthFix'></image>


+ 4
- 4
pages/index/index.js 查看文件

@@ -379,12 +379,12 @@ Page({
url: `/pages/getuserinfo/index?id=${options.id}&frommd=md` url: `/pages/getuserinfo/index?id=${options.id}&frommd=md`
}); });
} else { } else {
wx.redirectTo({
url: `/pages/getuserinfo/index`
});
wx.switchTab({
url: '/index/index',
})
} }
} }
});
})
}, },


getGameOne: function(token, id) { getGameOne: function(token, id) {


+ 141
- 135
pages/spellGroup/mySpellGroup/index.js 查看文件

@@ -3,7 +3,8 @@ const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
var config = require("../../../config/config.js"); var config = require("../../../config/config.js");
const Http = require("../../../utils/HttpBasics"); const Http = require("../../../utils/HttpBasics");
const imgurl = require("../../../utils/imgurl"); const imgurl = require("../../../utils/imgurl");
const utils = require("../../../utils/util.js")
const utils = require("../../../utils/util.js");
let app = getApp();
Page({ Page({


/** /**
@@ -22,7 +23,6 @@ Page({
quesGouUrl: imgurl.ques_gou.url, quesGouUrl: imgurl.ques_gou.url,
headbgUrl: imgurl.headbg.url, headbgUrl: imgurl.headbg.url,
quesBgUrl: imgurl.ques_bg.url, quesBgUrl: imgurl.ques_bg.url,

couponChannelId: '', couponChannelId: '',
couponId: '', couponId: '',
data: null, data: null,
@@ -64,8 +64,6 @@ Page({
if (options && options.couponId) { if (options && options.couponId) {
this.getOneSpell(options.couponId) this.getOneSpell(options.couponId)
} }
console.log(this.data.couponId)
this.getUserInfo();
}, },
/** /**
* 显示分享海报 * 显示分享海报
@@ -92,21 +90,6 @@ Page({
isshowposter: false, isshowposter: false,
}) })
}, },
getUserInfo: function() {
let that = this;
// 获取用户信息
Http.get({
url: config.api.getScore,
data: {}
})
.then(res => {
console.log(res)
that.setData({
nickName: res.data.nickName,
avatarUrl: res.data.avatarUrl
})
})
},
gotoIndex: function() { gotoIndex: function() {
wx.switchTab({ wx.switchTab({
url: '/index/index', url: '/index/index',
@@ -498,6 +481,7 @@ Page({
* 发起支付 * 发起支付
*/ */
orderFunc() { orderFunc() {
let that = this;
let orderGroupId = this.data.orderGroupId; let orderGroupId = this.data.orderGroupId;
let data = { let data = {
couponChannelId: this.data.data.id, couponChannelId: this.data.data.id,
@@ -507,7 +491,6 @@ Page({
/** /**
* 拼团订单 * 拼团订单
*/ */
let that = this;
if (this.data.orderGroupId == 0) { if (this.data.orderGroupId == 0) {
data.orderGroupId = this.data.orderGroupId, data.orderGroupId = this.data.orderGroupId,
that.setData({ that.setData({
@@ -518,125 +501,132 @@ Page({
isFromSpell: false isFromSpell: false
}) })
} }
Http.get({ Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res=>{
Http.get({
url: config.api.checkPhoneStatus, url: config.api.checkPhoneStatus,
data: {} data: {}
}) })
.then(res => {
/**
* orderSave 下单
*/
return Http.post({
url: config.api.orderSave,
data: data
});
})
.catch(err => {
console.log(err);
that.setData({
showbutton: false,
showbutton1: false,
canSpell: true,
canBuyIf: true
})
if (err.code == 2011) {
wx.showToast({
title: "商户信息没找到",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 2013) {
wx.showToast({
title: "商户信息禁用",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3000) {
wx.showToast({
title: "库存不足",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3001) {
wx.showToast({
title: "您已超过限购",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3002) {
wx.showToast({
title: "订单失败",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3003) {
wx.showToast({
title: "订单不存在",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3004) {
wx.showToast({
title: "订单不存在",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 4003) {
wx.showToast({
title: "卡券已作废",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3012) {
// wx.showToast({
// title: err.message,
// icon: "none"
// })
that.getUnPaidOrder(that.data.data.couponId);
} else if (err.code == 11005) {
.then(res => {
/** /**
* 将值传到用户手机号授权的页面
*
* orderSave 下单
*/ */
wx.redirectTo({
url: `/pages/getphoneInfo/index?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
return Http.post({
url: config.api.orderSave,
data: data
}); });
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
});
} else {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
}
})
.then(res => {
console.log(res)
if (typeof(res) != "undefined") {
let orderId = "" + res.data.id;
})
.catch(err => {
console.log(err);
that.setData({ that.setData({
orderId: orderId,
canSpell: false,
showbutton: false,
showbutton1: false,
canSpell: true,
canBuyIf: true canBuyIf: true
});
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
})
if (err.code == 2011) {
wx.showToast({
title: "商户信息没找到",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 2013) {
wx.showToast({
title: "商户信息禁用",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3000) {
wx.showToast({
title: "库存不足",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3001) {
wx.showToast({
title: "您已超过限购",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3002) {
wx.showToast({
title: "订单失败",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3003) {
wx.showToast({
title: "订单不存在",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3004) {
wx.showToast({
title: "订单不存在",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 4003) {
wx.showToast({
title: "卡券已作废",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
} else if (err.code == 3012) {
// wx.showToast({
// title: err.message,
// icon: "none"
// })
that.getUnPaidOrder(that.data.data.couponId);
} else if (err.code == 11005) {
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: `/pages/getphoneInfo/index?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
});
} else {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
}
})
.then(res => {
console.log(res)
if (typeof (res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
orderId: orderId,
canSpell: false,
canBuyIf: true
});
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate, url: config.api.payOrderCreate,
data: { data: {
orderId: orderId orderId: orderId
@@ -658,12 +648,12 @@ Page({
wx.showLoading({ wx.showLoading({
title: '订单正在处理中...', title: '订单正在处理中...',
}) })
setTimeout(function() {
setTimeout(function () {
wx.hideLoading() wx.hideLoading()
}, 5000) }, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId); that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId);
if (res.errMsg == "requestPayment:ok") { if (res.errMsg == "requestPayment:ok") {
setTimeout(function() {
setTimeout(function () {
wx.hideLoading(); wx.hideLoading();
}, 2000); }, 2000);
} }
@@ -680,7 +670,7 @@ Page({
}) })
return; return;
}, },
complete: res => {}
complete: res => { }
}); });
/// End payment -------- /// End payment --------
}) })
@@ -696,9 +686,25 @@ Page({
mask: false mask: false
}); });
}) })
}
}


})
})
})
.catch(err => {
console.log(err)
if(err.code == 11004){
wx.redirectTo({
url: `/pages/getuserinfo/index?fromflag=spellcoupondetail&couponChannelIdflag=${that.data.couponChannelId}`,
})
}else{
wx.showToast({
title: err.message,
icon:"none",
duration:2500
})
}
})
}, },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示


+ 5
- 2
pages/spellGroup/mySpellGroup/index.wxss 查看文件

@@ -1,4 +1,7 @@
/* pages/spellGroup/mySpellGroup/index.wxss */ /* pages/spellGroup/mySpellGroup/index.wxss */
page{
background: #F4F5F9;
}
.top-img{ .top-img{
width: 100%; width: 100%;
height: 533rpx; height: 533rpx;
@@ -43,7 +46,7 @@ button::after{ border: none; }
position: relative; position: relative;
width: 100%; width: 100%;
height: auto; height: auto;
background: #F4F5F9;
/* background: #F4F5F9; */
overflow: hidden; overflow: hidden;
padding-bottom: 130rpx; padding-bottom: 130rpx;
} }
@@ -195,7 +198,7 @@ button::after{ border: none; }
left:0; left:0;
right:0; right:0;
padding:20rpx 22rpx; padding:20rpx 22rpx;
/* background:#fff; */
background:transparent!important;
} }
.edit-left{ .edit-left{
float: left; float: left;


+ 0
- 17
pages/spellGroup/spellGroup.js 查看文件

@@ -74,7 +74,6 @@ Page({
}) })
} }
} }
that.getUserInfo();
}, },
onShow(){ onShow(){
let that=this; let that=this;
@@ -172,27 +171,11 @@ Page({
}) })
}, },
gotoEdit(e){ gotoEdit(e){
console.log(e.currentTarget.dataset.status)
let status = e.currentTarget.dataset.status let status = e.currentTarget.dataset.status
if (status==10){ if (status==10){


} }
}, },
getUserInfo: function () {
let that = this;
// 获取用户信息
Http.get({
url: config.api.getScore,
data: {}
})
.then(res => {
console.log(res)
that.setData({
nickName: res.data.nickName,
avatarUrl: res.data.avatarUrl
})
})
},
getList(pageNum, flag) { getList(pageNum, flag) {
var that = this; var that = this;
console.log(pageNum) console.log(pageNum)


Loading…
取消
儲存