Explorar el Código

【修复未授权手机不能拼团砍价问题】

release
GL hace 4 años
padre
commit
9bab3db737
Se han modificado 9 ficheros con 1080 adiciones y 953 borrados
  1. +0
    -1
      app.js
  2. +63
    -41
      ext.json
  3. +56
    -58
      index/index.js
  4. +99
    -79
      pages/bargain/bargainDatail/bargainDatail.js
  5. +343
    -321
      pages/coupon/detail/index.js
  6. +81
    -59
      pages/joinFrDpell/index.js
  7. +308
    -286
      pages/spellGroup/mySpellGroup/index.js
  8. +129
    -107
      pages/spellGroup/paySpellGroup/index.js
  9. +1
    -1
      project.config.json

+ 0
- 1
app.js Ver fichero

@@ -55,7 +55,6 @@ App({
Http.setToken(res.data.token);
that.globalData.token = res.data.token;
console.log(that.globalData.token)

if (that.tokenCallback) {
that.tokenCallback(res.data.token);
}


+ 63
- 41
ext.json Ver fichero

@@ -1,52 +1,74 @@
{
"ext": {
"attr": {
"imgProxy": [{
"newUrl": "https://ctest.malls.iformall.com/img",
"orgUrl": "https://iformall-net.formall.oss-accelerate.aliyuncs.com"
}, {
"newUrl": "https://ctest.malls.iformall.com/img1",
"orgUrl": "https://formall.oss-accelerate.aliyuncs.com"
}, {
"newUrl": "https://ctest.malls.iformall.com/img2",
"orgUrl": "https://wx.qlogo.cn"
}],
"configUrl": "https://ctest.malls.iformall.com/C/api",
"etcpAppId": "wx192b7d2e8dcbefd0",
"etcpVersion": "release",
"etcpCallbackUrl": "https://admintest.malls.iformall.com/api/carCallback/etcpPaidCallback",
"car": {
"tjd": {
"payPath": "",
"tjdAppId": "wx6945d1bda68d7993"
},
"etcp": {
"payPath": "pages/pay/order-pay-open/main",
"etcpAppId": "wxc07f9d67923d676d",
"etcpCallbackUrl": "https://admin.malls.iformall.com/api/carCallback/etcpPaidCallback"
},
"bolink": {
"payPath": "pages/park/park",
"bolinkAppId": "wxbd08b4baa10fcc1d"
},
"version": "release"
},
"imgProxy": [
{
"newUrl": "https://c.malls.iformall.com/img",
"orgUrl": "https://iformall-net.formall.oss-accelerate.aliyuncs.com"
},
{
"newUrl": "https://c.malls.iformall.com/img1",
"orgUrl": "https://formall.oss-accelerate.aliyuncs.com"
},
{
"newUrl": "https://c.malls.iformall.com/img2",
"orgUrl": "https://wx.qlogo.cn"
}
],
"configUrl": "https://c.malls.iformall.com/C/api",
"ifStoreApp": "0",
"ifHaveWebSocket": "0",
"ifHaveCarModular": "1"
},
"name": "金泸商务",
"weappId": "wx649b3be73c1afe47",
"appVersion": "C.test.5.2.0"
"name": "富茂链客生产版",
"weappId": "wx6a2524a8286d687f",
"appVersion": "C.5.1.1"
},
"debug": false,
"tabBar": {
"list": [{
"text": "首页",
"iconPath": "assets/images/home.png",
"pagePath": "index/index",
"selectedIconPath": "assets/images/home-a.png"
}, {
"text": "门店",
"iconPath": "assets/images/mendian.png",
"pagePath": "index/searchbar",
"selectedIconPath": "assets/images/mendian-a.png"
}, {
"text": "停车",
"iconPath": "assets/images/park.png",
"pagePath": "index/passCar",
"selectedIconPath": "assets/images/park-a.png"
}, {
"text": "我的",
"iconPath": "assets/images/user.png",
"pagePath": "index/user",
"selectedIconPath": "assets/images/user-a.png"
}],
"color": "#abb1be",
"selectedColor": "#b2743d"
"list": [
{
"text": "首页",
"iconPath": "assets/images/home.png",
"pagePath": "index/index",
"selectedIconPath": "assets/images/home-a.png"
},
{
"text": "门店",
"iconPath": "assets/images/mendian.png",
"pagePath": "index/searchbar",
"selectedIconPath": "assets/images/mendian-a.png"
},
{
"text": "停车",
"iconPath": "assets/images/park.png",
"pagePath": "index/passCar",
"selectedIconPath": "assets/images/park-a.png"
},
{
"text": "我的",
"iconPath": "assets/images/user.png",
"pagePath": "index/user",
"selectedIconPath": "assets/images/user-a.png"
}
],
"custom": true
},
"window": {
"backgroundTextStyle": "dark",
@@ -60,7 +82,7 @@
"provider": "wx2b03c6e691cd7370"
}
},
"extAppid": "wx649b3be73c1afe47",
"extAppid": "wx6a2524a8286d687f",
"extEnable": true,
"permission": {
"scope.userLocation": {


+ 56
- 58
index/index.js Ver fichero

@@ -81,19 +81,19 @@ Page({
openId: '',
showGg: false,
ggdata: {},
liveFlag:0,//直播按钮显隐标志位
squareName:"",//当前广场
isShowSqare:false,
liveFlag: 0, //直播按钮显隐标志位
squareName: "", //当前广场
isShowSqare: false,
},
//获取当前广场名

//跳转到其他广场列表
goSquareList(){
goSquareList() {
wx.navigateTo({
url: '/pages/location/location',
})
},
goLive(){
goLive() {
wx.navigateTo({
url: '/pages2/live/livelist/index',
})
@@ -214,12 +214,12 @@ Page({
})
},
//是否属于集团
ifShowSqare(){
if (wx.getStorageSync("squareList")){
ifShowSqare() {
if (wx.getStorageSync("squareList")) {
this.setData({
isShowSqare:true
isShowSqare: true
})
}else{
} else {
this.setData({
isShowSqare: false
})
@@ -286,7 +286,7 @@ Page({
}
})
},
onUnload(){
onUnload() {
wx.removeStorageSync('squareList')
},
onShow: function() {
@@ -412,55 +412,53 @@ Page({
var that = this;

app.tokenCallback = token => {
// 登录
console.log(app.globalData.token)
that.getmemberId(app.globalData.token);
that.getBannerlist();
that.topicShow();
that.getxsList();
that.getMallInfo(app.globalData.token);

// 登录
console.log(app.globalData.token)
that.getmemberId(app.globalData.token);
that.getBannerlist();
that.topicShow();
that.getxsList();
that.getMallInfo(app.globalData.token);

if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token);
}
if (app.couponListCallback) {
app.couponListCallback(app.globalData.token);
}
if (app.businessListCallback) {
app.businessListCallback(app.globalData.token);
}
Http.get({
url: config.api.getWeapNote,
data: {
appId: config.weapp.AppId,
}
})
.then(res => {
console.log(33333333333)
console.log(app.globalData.token)
console.log(res)
console.log(33333333333)
// that.getGameOne(app.globalData.token)
that.getStaticGame(app.globalData.token)
that.getGg(app.globalData.token)
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
desc: weapNote.firstpage.desc,
title: weapNote.firstpage.title
if (app.couponChannelListCallback) {
app.couponChannelListCallback(app.globalData.token);
}
if (app.couponListCallback) {
app.couponListCallback(app.globalData.token);
}
if (app.businessListCallback) {
app.businessListCallback(app.globalData.token);
}
Http.get({
url: config.api.getWeapNote,
data: {
appId: config.weapp.AppId,
}
})
})
.catch(err => {
// that.getGameOne(app.globalData.token)
that.getStaticGame(app.globalData.token)
that.getGg(app.globalData.token)
wx.showModal({
title: "提示",
content: err.errMsg,
showCancel: false
.then(res => {
console.log(33333333333)
console.log(app.globalData.token)
console.log(res)
console.log(33333333333)
// that.getGameOne(app.globalData.token)
that.getStaticGame(app.globalData.token)
that.getGg(app.globalData.token)
let weapNote = JSON.parse(res.data.weapNote);
that.setData({
desc: weapNote.firstpage.desc,
title: weapNote.firstpage.title
})
})
.catch(err => {
// that.getGameOne(app.globalData.token)
that.getStaticGame(app.globalData.token)
that.getGg(app.globalData.token)
wx.showModal({
title: "提示",
content: err.errMsg,
showCancel: false
});
});
});
}
},

@@ -535,11 +533,11 @@ Page({
}
}).then(res => {
that.setData({
liveFlag: res.data.liveSupport ,
liveFlag: res.data.liveSupport,
weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null,
weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null,
});
console.log(that.data.liveFlag,"||||")
console.log(that.data.liveFlag, "||||")
})
.catch(err => {
// 不需要错误提示


+ 99
- 79
pages/bargain/bargainDatail/bargainDatail.js Ver fichero

@@ -32,31 +32,52 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let that = this;
if (options.orderId || options.orderId && options.from == 'discount') {
if (options.from) {
that.setData({
orderId: options.orderId,
from: "discount"
})
} else {
that.setData({
orderId: options.orderId
})
onLoad: function(options) {
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
app.globalData.wmorder = options.orderId
that.pressOrderDetail(options.orderId);
}
this.getUserInfo()
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {
let that = this;
if (options.orderId || options.orderId && options.from == 'discount') {
if (options.from) {
that.setData({
orderId: options.orderId,
from: "discount"
})
} else {
that.setData({
orderId: options.orderId
})
}
app.globalData.wmorder = options.orderId
that.pressOrderDetail(options.orderId);
}
this.getUserInfo()
}).catch(res=>{
wx.redirectTo({
url: `/pages/getphoneInfo/index`
});
})
}).catch(res => {
wx.redirectTo({
url: `/pages/getuserinfo/index`
})
})

},
getUserInfo: function () {
getUserInfo: function() {
let that = this;
// 获取用户信息
Http.get({
url: config.api.getScore,
data: {}
})
url: config.api.getScore,
data: {}
})
.then(res => {
console.log(res)
that.setData({
@@ -65,7 +86,7 @@ Page({
})
})
},
onShow: function () {
onShow: function() {
let that = this;
var todayDate = new Date().getTime();
that.setData({
@@ -76,7 +97,7 @@ Page({
that.countdown(that.data.pressEndDate)
}
},
goback: function () {
goback: function() {
wx.switchTab({
url: '/index/index',
})
@@ -84,7 +105,7 @@ Page({
/**
* 更多砍价商品
*/
gotomore: function () {
gotomore: function() {
wx.navigateTo({
url: '/pages/bargain/bargain',
})
@@ -92,14 +113,14 @@ Page({
/**
* @param {砍价状态(1:我发起的砍价,2:未参与的砍价, 3:已参与的砍价)} orderId
*/
getPressOrderStatus: function (orderId) {
getPressOrderStatus: function(orderId) {
let that = this;
Http.get({
url: config.api.getPressOrderStatus,
data: {
orderId: orderId
}
})
url: config.api.getPressOrderStatus,
data: {
orderId: orderId
}
})
.then(res => {
if (res.data.status == 1) {
that.setData({
@@ -125,23 +146,22 @@ Page({
})
})
},
helpDiscount: function () {
let that = this;
that.pressOrderJoin(that.data.orderId);
helpDiscount: function() {
let that = this;
that.pressOrderJoin(that.data.orderId);
},
//参与砍价
pressOrderJoin: function (orderId) {
pressOrderJoin: function(orderId) {
let that = this;
Http.post({
url: config.api.pressOrderJoin,
data: {
orderId: orderId
}
})
url: config.api.pressOrderJoin,
data: {
orderId: orderId
}
})
.then(res => {
console.log(res);
// id 是订单号

that.pressOrderDetail(orderId);
})
.catch(err => {
@@ -153,14 +173,14 @@ Page({
})
},
// 订单详情
pressOrderDetail: function (orderId) {
pressOrderDetail: function(orderId) {
let that = this;
Http.get({
url: config.api.pressOrderDetail,
data: {
orderId: orderId
}
})
url: config.api.pressOrderDetail,
data: {
orderId: orderId
}
})
.then(res => {
console.log(res);
res.data.orderPressList.map(file => {
@@ -219,10 +239,10 @@ Page({
}
total_micro_second -= 1000;
},
countdown: function (end_time) {
countdown: function(end_time) {
let that = this;
that.setIntervalTime(end_time);
that.data.setInterval = setInterval(function () {
that.data.setInterval = setInterval(function() {
that.setIntervalTime(end_time);
}, 1000)
},
@@ -254,14 +274,14 @@ Page({
console.log(_this)
// 支付成功
Http.post({
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
.then(res => {
wx.hideLoading();
_this.setData({
@@ -285,7 +305,7 @@ Page({
.catch(err => {
console.log(err);
if (!type) {
setTimeout(function () {
setTimeout(function() {
_this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this);
}, 2000)
}
@@ -523,14 +543,14 @@ Page({
showButton1: true
})
Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
that.setData({
showButton1: false
})
if (typeof (res) != "undefined") {
if (typeof(res) != "undefined") {
let orderId = "" + e.currentTarget.dataset.orderid;
that.setData({
orderId: orderId
@@ -540,11 +560,11 @@ Page({
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
@@ -558,12 +578,12 @@ Page({
wx.showLoading({
title: '订单正在处理中...',
})
setTimeout(function () {
setTimeout(function() {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function () {
setTimeout(function() {
wx.hideLoading();
}, 2000);
/**
@@ -592,7 +612,7 @@ Page({
})
return;
},
complete: res => { }
complete: res => {}
});
/// End payment --------
})
@@ -687,7 +707,7 @@ Page({
title: '提示',
content: '您有未支付订单,请先进行支付',
confirmText: "去支付",
success: function (res) {
success: function(res) {
console.log(res.confirm)
if (res.confirm) {
wx.navigateTo({
@@ -725,11 +745,11 @@ Page({
}
})
},
onUnload: function () {
onUnload: function() {
let that = this;
clearInterval(that.data.setInterval)
},
onHide: function () {
onHide: function() {
let that = this;
clearInterval(that.data.setInterval)
},
@@ -737,7 +757,7 @@ Page({
*
* @param {朋友邀请砍价} e
*/
barginAgain: function (e) {
barginAgain: function(e) {
let that = this;
let couponChannelId = e.currentTarget.dataset.couponchannelid;
let couponId = e.currentTarget.dataset.couponid;
@@ -748,23 +768,23 @@ Page({
/**
* 刷新
*/
onPullDownRefresh: function (e) {
onPullDownRefresh: function(e) {
let that = this;
console.log(app.globalData.wmorder);
if (app.globalData.wmorder) {
that.pressOrderDetail(app.globalData.wmorder);
}
},
onShareAppMessage: function (options) {
onShareAppMessage: function(options) {
var that = this;
var shareObj = {
title: that.data.nickName + '邀请您帮砍' + that.data.data.title,
path: `/pages/index/index?orderId=${that.data.data.id}&from=${"discount"}`,
success: function (res) {
if (res.errMsg == 'shareAppMessage:ok') { }
success: function(res) {
if (res.errMsg == 'shareAppMessage:ok') {}
},
fail: function (error) {
if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { }
fail: function(error) {
if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {}
}
};
// 来自页面内的按钮的转发
@@ -806,7 +826,7 @@ function diffTime(startDate) {
}

function compare(property) {
return function (a, b) {
return function(a, b) {
var value1 = a[property];
var value2 = b[property];
return value2 - value1;


+ 343
- 321
pages/coupon/detail/index.js Ver fichero

@@ -8,7 +8,7 @@ Page({
data: {
navigationBarHeight,
homeSelectedO: imgurl.homeSelectedO.url,
isshowposter:false,//是否显示分享弹框
isshowposter: false, //是否显示分享弹框
fenxiang: imgurl.fenxiang1.url,
fenxiangUrl: imgurl.fenxiang.url,
clockUrl: imgurl.clock.url,
@@ -22,8 +22,8 @@ Page({
fail: imgurl.fail.url,
wmhome: imgurl.wmhome.url,
swiperCurrent: 0,
detailPicture:[],
coverPicture:[],
detailPicture: [],
coverPicture: [],
data: {
title: null
},
@@ -78,12 +78,12 @@ Page({
sec02: "00",
countdown: "",
showbutton1: false,
limitCondition:"",
minLimit:0,
maxLimit:0,
dispressEndDate:false,
barTitle:"",
activityStatus:"",
limitCondition: "",
minLimit: 0,
maxLimit: 0,
dispressEndDate: false,
barTitle: "",
activityStatus: "",
//图文混排
curHtml: '',
contentType: 0,
@@ -97,7 +97,7 @@ Page({
isshowposter: true,
})
},
/**
/**
* 隐藏分享弹框
*/
hidemodal: function() {
@@ -105,7 +105,7 @@ Page({
isshowposter: false,
})
},
/**
/**
* 显示分享海报
*/
/* showPoster: function() {
@@ -120,33 +120,33 @@ Page({
showPoster: function() {
//跳转到海报生成页
let that = this;
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
wx.navigateTo({
url: `/pages/canvas/index?couponChannelId=${that.data.data.id}`
})
}).catch(err => {
console.log(err)
if (err.code == 11004) {
// 用户昵称未授权
wx.redirectTo({
url: `/pages/getuserinfo/index?couponChannelId=${that.data.data.id}&fromflag=poster`
})
}
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
wx.navigateTo({
url: `/pages/canvas/index?couponChannelId=${that.data.data.id}`
})
}).catch(err => {
console.log(err)
if (err.code == 11004) {
// 用户昵称未授权
wx.redirectTo({
url: `/pages/getuserinfo/index?couponChannelId=${that.data.data.id}&fromflag=poster`
})
}
})

},
swiperChange: function (e) {
swiperChange: function(e) {
this.setData({
swiperCurrent: e.detail.current
});
},
//获取当前登录用户信息
getUserInfo: function() {
let that = this;
@@ -297,60 +297,83 @@ Page({
}, 500)
},
gotopay: function(e) {
let that = this;
console.log(e);
wx.showLoading();
if (e.currentTarget.dataset.type == 51 || e.currentTarget.dataset.type == 50){
wx.navigateTo({
url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId,
})
}else{
let formId = e.detail.formId;
var discount = e.detail.target.dataset.discount;
that.setData({
queueData: null,
showbutton: true,
formId: formId
})
/* 判断是否授权*/
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
Http.get({
url: config.api.getQuestion,
data: {
couponType: JSON.stringify(that.data.data.type)
}
})
.then(res => {
wx.hideLoading();
if (res.data == undefined) {
// 立即购买
that.orderFunc(discount);
that.setData({
flag: false
})
} else if (res.data) {
var animation = wx.createAnimation({});
animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({
duration: 500
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {
let that = this;
console.log(e);
wx.showLoading();
if (e.currentTarget.dataset.type == 51 || e.currentTarget.dataset.type == 50) {
wx.navigateTo({
url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId,
})
} else {
let formId = e.detail.formId;
var discount = e.detail.target.dataset.discount;
that.setData({
queueData: animation.export(),
zIndex: 9,
opacity: 1,
display: "block",
questionnaire: JSON.parse(res.data.content),
questionId: res.data.id
});
queueData: null,
showbutton: true,
formId: formId
})
Http.get({
url: config.api.getQuestion,
data: {
couponType: JSON.stringify(that.data.data.type)
}
})
.then(res => {
wx.hideLoading();
if (res.data == undefined) {
// 立即购买
that.orderFunc(discount);
that.setData({
flag: false
})
} else if (res.data) {
var animation = wx.createAnimation({});
animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({
duration: 500
})
that.setData({
queueData: animation.export(),
zIndex: 9,
opacity: 1,
display: "block",
questionnaire: JSON.parse(res.data.content),
questionId: res.data.id
});
}
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
}
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
}).catch(err => {
wx.redirectTo({
url: `/pages/getphoneInfo/index?skipUrl=1`
});
})
}

}).catch(err => {
wx.navigateTo({
url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${this.data.couponChannelId}`,
})
})

},
setIntervalTime(end_time) {
let that = this;
@@ -414,7 +437,7 @@ Page({
*/
onLoad(options) {
let that = this;
if (options.g){
if (options.g) {
app.globalData.havePlayEd1 = true;
}
wx.showLoading({
@@ -423,7 +446,7 @@ Page({
that.setData({
onshow: false
})
if (options && options.couponChannelId){
if (options && options.couponChannelId) {
that.getDetail(options.couponChannelId, 'notendclock');
}
/**
@@ -497,11 +520,11 @@ Page({
coverPicture: JSON.parse(res.data.coverPicture)
})
}
if (res && res.data && res.data.conditions){
if (res && res.data && res.data.conditions) {
that.setData({
limitCondition: JSON.parse(res.data.conditions).type
})
if (JSON.parse(res.data.conditions).type == 2 && (JSON.parse(res.data.conditions).min || JSON.parse(res.data.conditions).min==0)){
if (JSON.parse(res.data.conditions).type == 2 && (JSON.parse(res.data.conditions).min || JSON.parse(res.data.conditions).min == 0)) {
that.setData({
minLimit: JSON.parse(res.data.conditions).min
})
@@ -534,7 +557,7 @@ Page({
that.setData({
begin_time: res.data.beginTime,
end_time: res.data.endTime,
activityStatus: res.data.activityStatus ? res.data.activityStatus:''
activityStatus: res.data.activityStatus ? res.data.activityStatus : ''
})
if (res.data.activityStatus == 0 && flag != 'endclock') {
that.countdown(res.data.beginTime);
@@ -647,12 +670,12 @@ Page({
}
})
},
checkPhoneStatus: function () {
checkPhoneStatus: function() {
let that = this;
Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
console.log(666, '授权成功!')
that.receiveCard()
@@ -693,272 +716,272 @@ Page({
}
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
// 发起砍价
if (discount == 'discount') {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
press: true
}
} else if (discount == 'discount1') {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
press: false
}
} else if (that.data.couponChannelId == null) {
var data = {
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
};
} else {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
}
}
/**
* orderSave 下单
*/
return Http.post({
url: config.api.orderSave,
data: data
});
})
.catch(err => {
wx.hideLoading()
that.setData({
showbutton: false,
showbutton1: false
url: config.api.checkPhoneStatus,
data: {}
})
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) {
that.getUnPaidOrder(that.data.couponId);
} else if (err.code == 11005) {
.then(res => {
// 发起砍价
if (discount == 'discount') {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
press: true
}
} else if (discount == 'discount1') {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
press: false
}
} else if (that.data.couponChannelId == null) {
var data = {
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
};
} else {
var data = {
couponChannelId: "" + that.data.couponChannelId,
couponId: "" + that.data.couponId,
formId: "" + that.data.formId,
}
}
/**
* 将值传到用户手机号授权的页面
*
* orderSave 下单
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index?couponChannelId=" +
that.data.couponChannelId
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput?couponChannelId=" +
that.data.couponChannelId
});
} else {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
return Http.post({
url: config.api.orderSave,
data: data
});
}
})
.then(res => {
if (discount != 'discount') {
if (typeof(res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
orderId: orderId
})
.catch(err => {
wx.hideLoading()
that.setData({
showbutton: false,
showbutton1: false
})
if (err.code == 2011) {
wx.showToast({
title: "商户信息没找到",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
if (res.data.payment > 0) {
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
wx.showLoading({
title: '订单正在处理中...',
})
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
if (res.errMsg == "requestPayment:ok") {
} 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) {
that.getUnPaidOrder(that.data.couponId);
} else if (err.code == 11005) {
/**
* 将值传到用户手机号授权的页面
*
*/
wx.redirectTo({
url: "/pages/getphoneInfo/index?couponChannelId=" +
that.data.couponChannelId
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: "/pages/phoneinput/phoneinput?couponChannelId=" +
that.data.couponChannelId
});
} else {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
}
})
.then(res => {
if (discount != 'discount') {
if (typeof(res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
orderId: orderId
});
if (res.data.payment > 0) {
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
wx.showLoading({
title: '订单正在处理中...',
})
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
if (res.errMsg == "requestPayment:ok") {
/**
* 用户支付成功以后跳转到券包列表
*/
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != 5 && that.data.cardType != 100) {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
}
}
},
fail: res => {
wx.hideLoading();
/**
* 用户支付成功以后跳转到券包列表
* 支付失败,需要更新订单的状态
*/
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != 5 && that.data.cardType != 100) {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
}
}
},
fail: res => {
wx.hideLoading();
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
that.setData({
showbutton: false
})
return;
},
complete: res => {}
});
/// End payment --------
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
} else {
// 免费券
that.payOrderUpdate(orderId, "0", 1, '', 'free',that);
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != "5" && that.data.cardType != 100) {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
that.setData({
showbutton: false
})
return;
},
complete: res => {}
});
/// End payment --------
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
} else {
// 免费券
that.payOrderUpdate(orderId, "0", 1, '', 'free', that);
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != "5" && that.data.cardType != 100) {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
}
}
}
} else {
if (res) {
wx.navigateTo({
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`,
})
}
}
} else {
if (res) {
wx.navigateTo({
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`,
})
}
}
})
})
}).catch(err => {
console.log(err)
if(err.code == 11004){
if (err.code == 11004) {
wx.redirectTo({
url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`,
})
}else{
} else {
wx.showToast({
title: err.message,
icon:"none",
duration:2500
icon: "none",
duration: 2500
})
}
})
},
// 获得未支付的订单
getUnPaidOrder(couponId){
getUnPaidOrder(couponId) {
let that = this;
Http.get({
url: config.api.getUnPaidOrder,
data: {
couponId: couponId
}
}).then(res=>{
}).then(res => {
that.setData({
disOrderNumber: res.data.orderNumber,
})
if (res.data&&res.data.pressEndDate){
if (res.data && res.data.pressEndDate) {
that.setData({
dispressEndDate:true
dispressEndDate: true
})
}else{
} else {
that.setData({
dispressEndDate: false
})
}
if (that.data.dispressEndDate){
if (that.data.dispressEndDate) {
wx.showModal({
title: '提示',
content: "您有未支付订单,请到“我的-我的砍价”进行支付",
confirmText:"我的砍价",
success: function (res) {
confirmText: "我的砍价",
success: function(res) {
if (res.confirm) {
wx.navigateTo({
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}`,
@@ -966,12 +989,12 @@ Page({
}
}
})
} else{
} else {
wx.showModal({
title: '提示',
content: '您有未支付订单,请先进行支付',
confirmText: "去支付",
success: function (res) {
success: function(res) {
if (res.confirm) {
wx.navigateTo({
url: `/pages/order/detail/index?orderId=${that.data.disOrderNumber}&contentType=${that.data.contentType}`,
@@ -980,7 +1003,7 @@ Page({
}
})
}
}).catch(error=>{
}).catch(error => {
wx.showToast({
title: error.message,
icon: "none",
@@ -993,10 +1016,9 @@ Page({
showbutton: false,
showbutton1: false
})
if (this.data.end_time && this.data.activityStatus!=0) {
if (this.data.end_time && this.data.activityStatus != 0) {
this.countdown(this.data.end_time)
}
else if (this.data.begin_time && this.data.activityStatus == 0) {
} else if (this.data.begin_time && this.data.activityStatus == 0) {
this.countdown(this.data.begin_time)
}
},


+ 81
- 59
pages/joinFrDpell/index.js Ver fichero

@@ -4,6 +4,7 @@ var config = require("../../config/config.js");
const Http = require("../../utils/HttpBasics");
const imgurl = require("../../utils/imgurl");
const utils = require("../../utils/util.js")
let app = getApp();
Page({

/**
@@ -26,8 +27,8 @@ Page({
hour: "00",
min: "00",
sec: "00",
paramData:null,
showErr:false,
paramData: null,
showErr: false,
showTime: true,
merchantVoList: []
},
@@ -35,21 +36,42 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
paramData:options,
couponChannelId: options.couponChannelId,
couponId: options.couponId,
orderGroupId: options.orderGroupId,
orderId:options.orderId,
avatarUrl: options.avatarUrl,
nickName: options.nickName,
onLoad: function(options) {
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {
this.setData({
paramData: options,
couponChannelId: options.couponChannelId,
couponId: options.couponId,
orderGroupId: options.orderGroupId,
orderId: options.orderId,
avatarUrl: options.avatarUrl,
nickName: options.nickName,
})
if (options.orderGroupId) {
this.checkUser(options);
}

}).catch(res => {
wx.redirectTo({
url: `/pages/getphoneInfo/index`
});
})
}).catch(res => {
wx.redirectTo({
url: `/pages/getuserinfo/index`
})
})
if (options.orderGroupId){
this.checkUser(options);
}
},
gotoIndex(){
gotoIndex() {
wx.reLaunch({
url: '/pages/index/index',
})
@@ -57,7 +79,7 @@ Page({
/**
* 判断用户是否已经在团中
*/
checkUser(options){
checkUser(options) {
let that = this;
Http.get({
url: config.api.queryAttendStatus,
@@ -66,11 +88,11 @@ Page({
}
}).then(res => {
wx.stopPullDownRefresh();
if (res.data.attend == true || res.data.status!=10) {
if (res.data.attend == true || res.data.status != 10) {
wx.redirectTo({
url: `/pages/spellDetail/index?orderId=${options.orderId}&couponId=${options.couponId}&orderGroupId=${options.orderGroupId}&couponChannelId=${options.couponChannelId}`,
})
}else{
} else {
that.getDetail(that.data.couponChannelId);
that.getOneSpell(that.data.couponId)
}
@@ -79,7 +101,7 @@ Page({
/**
* 拨打电话
*/
phone: function (e) {
phone: function(e) {
let that = this;
wx.makePhoneCall({
phoneNumber: e.target.dataset.merchantlinkphone
@@ -90,9 +112,9 @@ Page({
*/
gotoBuy(e) {
let formId = e.detail.formId;
let that=this;
let that = this;
that.setData({
formId:formId
formId: formId
})
this.setData({
canBuyIf: false
@@ -151,7 +173,7 @@ Page({
// that.getOneSpell(that.data.couponId)
}
if (that.data.showTime) {
setTimeout(function () {
setTimeout(function() {
total_micro_second -= 1000;
that.countdown();
}, 1000)
@@ -216,13 +238,13 @@ Page({
let that = this;
// 支付成功
Http.post({
url: config.api.toOrderGroup,
data: {
id: orderGroupId,
orderId,
couponId: _this.data.data.couponId
}
})
url: config.api.toOrderGroup,
data: {
id: orderGroupId,
orderId,
couponId: _this.data.data.couponId
}
})
.then(res => {
wx.reLaunch({
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.data.couponId}&orderGroupId=${res.data.orderGroupId}&couponChannelId=${_this.data.couponChannelId}`
@@ -239,23 +261,23 @@ Page({
payOrderUpdate: (orderId, payOrderId, status, reason, _this, orderGroupId) => {
// 支付成功
Http.post({
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
.then(res => {
wx.hideLoading()
if (res.data.orderStatus==14){
if (res.data.orderStatus == 14) {
_this.setData({
showErr:true
showErr: true
})
return;
}
if (orderGroupId==undefined) {
if (orderGroupId == undefined) {
wx.navigateTo({
url: '/pages/order/detail/index?orderId=' + res.data.id,
})
@@ -266,7 +288,7 @@ Page({
.catch(err => {
console.log(err);
if (err.code != 12002) {
setTimeout(function () {
setTimeout(function() {
_this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId);
}, 2000)
}
@@ -279,7 +301,7 @@ Page({
let data = {
couponChannelId: this.data.data.id,
couponId: this.data.data.couponId,
orderId:this.data.formId
orderId: this.data.formId
}
/**
* 拼团订单
@@ -288,9 +310,9 @@ Page({

var that = this;
Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
url: config.api.checkPhoneStatus,
data: {}
})
.then(res => {
/**
* orderSave 下单
@@ -376,7 +398,7 @@ Page({
console.log(that.data, 444)
wx.redirectTo({
url: "/pages/getphoneInfo/index?path=spell&couponChannelId=" +
that.data.couponChannelId + '&orderGroupId=' + that.data.orderGroupId+ '&couponId=' + that.data.couponId + '&orderId=' + that.data.orderId + '&avatarUrl=' + that.data.avatarUrl + '&nickName=' + that.data.nickName
that.data.couponChannelId + '&orderGroupId=' + that.data.orderGroupId + '&couponId=' + that.data.couponId + '&orderId=' + that.data.orderId + '&avatarUrl=' + that.data.avatarUrl + '&nickName=' + that.data.nickName
});
} else if (err.code == 11006) {
// 用户手机已加密
@@ -395,7 +417,7 @@ Page({
})
.then(res => {
console.log(res)
if (typeof (res) != "undefined") {
if (typeof(res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
orderId: orderId,
@@ -407,11 +429,11 @@ Page({
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
@@ -428,12 +450,12 @@ Page({
that.setData({
canSpell: false
})
setTimeout(function () {
setTimeout(function() {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function () {
setTimeout(function() {
wx.hideLoading();
}, 2000);
}
@@ -450,7 +472,7 @@ Page({
})
return;
},
complete: res => { }
complete: res => {}
});
/// End payment --------
})
@@ -473,7 +495,7 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
this.setData({
canSpell: true,
canBuyIf: true,
@@ -487,7 +509,7 @@ Page({
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
this.setData({
showTime: false
})
@@ -496,7 +518,7 @@ Page({
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
this.setData({
showTime: false
})
@@ -505,7 +527,7 @@ Page({
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
this.checkUser(this.data.paramData)
}
})

+ 308
- 286
pages/spellGroup/mySpellGroup/index.js Ver fichero

@@ -13,8 +13,8 @@ Page({
data: {
navigationBarHeight,
fenxiang: imgurl.fenxiang1.url,
homeSelectedO:imgurl.homeSelectedO.url,
isshowposter:false,//是否显示分享弹框
homeSelectedO: imgurl.homeSelectedO.url,
isshowposter: false, //是否显示分享弹框
teljpgUrl: imgurl.teljpg.url,
wmhome: imgurl.wmhome.url,
share01: imgurl.share01.url,
@@ -41,31 +41,53 @@ Page({
limitCondition: "",
minLimit: 0,
maxLimit: 0,
spellGroupOrder:false,
spellGroupOrder: false,
opacity: 0,
queueData: null,
zIndex: 11,
display: "none",
orderGroupId:'',
merchantVoList:[]
orderGroupId: '',
merchantVoList: []
},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
couponChannelId: options.couponChannelId,
couponId: options.couponId ? options.couponId:''
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {

this.setData({
couponChannelId: options.couponChannelId,
couponId: options.couponId ? options.couponId : ''
})
if (options && options.couponChannelId) {
this.getDetail(options.couponChannelId);
}
if (options && options.couponId) {
this.getOneSpell(options.couponId)
}
}).catch(res => {
wx.redirectTo({
url: `/pages/getphoneInfo/index`
});
})
}).catch(res => {
wx.redirectTo({
url: `/pages/getuserinfo/index`
})
})
if (options && options.couponChannelId) {
this.getDetail(options.couponChannelId);
}
if (options && options.couponId) {
this.getOneSpell(options.couponId)
}

},
/**
/**
* 显示分享海报
*/
/* showPoster: function() {
@@ -77,28 +99,28 @@ Page({
showPoster: function() {
console.log(this.data.data)
let that = this;
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
wx.navigateTo({
url: `/pages/canvas/index?couponChannelId=${that.data.data.id}`
})
}).catch(err => {
console.log(err)
if (err.code == 11004) {
// 用户昵称未授权
wx.redirectTo({
url: `/pages/getuserinfo/index?couponChannelId=${that.data.data.id}&fromflag=poster`
})
}
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
wx.navigateTo({
url: `/pages/canvas/index?couponChannelId=${that.data.data.id}`
})
}).catch(err => {
console.log(err)
if (err.code == 11004) {
// 用户昵称未授权
wx.redirectTo({
url: `/pages/getuserinfo/index?couponChannelId=${that.data.data.id}&fromflag=poster`
})

}
})

//跳转到海报生成页
},
/**
* 显示分享弹框
@@ -108,7 +130,7 @@ Page({
isshowposter: true,
})
},
/**
/**
* 隐藏分享弹框
*/
hidemodal: function() {
@@ -139,52 +161,52 @@ Page({
canBuyIf: false,
formId: e.detail.formId,
queueData: null,
orderGroupId:''
orderGroupId: ''
})
that.getQuestions();
},
getQuestions(type){
getQuestions(type) {
let that = this;
Http.get({
url: config.api.getQuestion,
data: {
couponType: JSON.stringify(that.data.data.type)
}
})
.then(res => {
wx.hideLoading();
if (res.data == undefined) {
// 立即购买
that.orderFunc(type);
} else if (res.data) {
var animation = wx.createAnimation({});
animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({
duration: 500
})
that.setData({
queueData: animation.export(),
zIndex: 9,
opacity: 1,
display: "block",
questionnaire: JSON.parse(res.data.content),
questionId: res.data.id
url: config.api.getQuestion,
data: {
couponType: JSON.stringify(that.data.data.type)
}
})
.then(res => {
wx.hideLoading();
if (res.data == undefined) {
// 立即购买
that.orderFunc(type);
} else if (res.data) {
var animation = wx.createAnimation({});
animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({
duration: 500
})
that.setData({
queueData: animation.export(),
zIndex: 9,
opacity: 1,
display: "block",
questionnaire: JSON.parse(res.data.content),
questionId: res.data.id
});
}
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
}
})
.catch(err => {
wx.hideLoading();
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
})
},
/**
* 点击提交问题单选
*/
formSubmit: function (e) {
formSubmit: function(e) {
console.log(e);
let that = this;
/**
@@ -202,12 +224,12 @@ Page({
console.log(answserIs)
console.log(e.currentTarget.dataset.questionid)
Http.post({
url: config.api.answerQuestion,
data: {
answer: answserIs,
questionId: e.currentTarget.dataset.questionid
}
})
url: config.api.answerQuestion,
data: {
answer: answserIs,
questionId: e.currentTarget.dataset.questionid
}
})
.then(res => {
that.closeQuestion();
})
@@ -223,21 +245,21 @@ Page({
/**
* 多选
*/
checkboxChange: function (e) {
checkboxChange: function(e) {
console.log(e)
this.setData({
anwserId: e.detail.value
})
},

closeQuestion: function () {
closeQuestion: function() {
let that = this;
that.setData({
display: "none",
zIndex: 11,
opacity: 0
})
setTimeout(function () {
setTimeout(function() {
that.orderFunc();
}, 500)
},
@@ -312,7 +334,7 @@ Page({
})

// 拼团订单
if (res.data.payment/100 != Number(that.data.data.price)) {
if (res.data.payment / 100 != Number(that.data.data.price)) {
that.setData({
spellGroupOrder: true
})
@@ -327,12 +349,12 @@ Page({
title: '提示',
content: "您有未支付拼团订单,请先进行支付",
confirmText: "去支付",
success: function (res) {
success: function(res) {
if (res.confirm) {
wx.navigateTo({
url: `/pages/spellGroup/paySpellGroup/index?orderId=${that.data.disOrderNumber}&couponChannelId=${that.data.couponChannelId}&couponId=${couponId}&orderGroupId={that.data.orderGroupId}`,
})
}
}
})
@@ -341,7 +363,7 @@ Page({
title: '提示',
content: '您有未支付订单,请先进行支付',
confirmText: "去支付",
success: function (res) {
success: function(res) {
if (res.confirm) {
wx.navigateTo({
url: `/pages/order/detail/index?orderId=${that.data.disOrderNumber}`,
@@ -354,8 +376,8 @@ Page({
console.log(error)
wx.showToast({
title: error.message,
icon:"none",
duration:3000
icon: "none",
duration: 3000
})
})
},
@@ -367,7 +389,7 @@ Page({
that.setData({
canSpell: false,
formId: e.detail.formId,
orderGroupId:0
orderGroupId: 0
})
that.getQuestions(0);
},
@@ -519,218 +541,218 @@ Page({
*/
if (this.data.orderGroupId == 0) {
data.orderGroupId = this.data.orderGroupId,
that.setData({
isFromSpell:true
})
}else{
that.setData({
isFromSpell: true
})
} else {
that.setData({
isFromSpell: false
})
}
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res=>{
Http.get({
url: config.api.checkPhoneStatus,
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
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus,
data: {}
})
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}`
});
} else if (err.code == 11006) {
// 用户手机已加密
wx.redirectTo({
url: `/pages/phoneinput/phoneinput?path=spell&couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}`
return Http.post({
url: config.api.orderSave,
data: data
});
} 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({
orderId: orderId,
canSpell: false,
showbutton: false,
showbutton1: false,
canSpell: true,
canBuyIf: true
});
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
that.setData({
canSpell: false
})
wx.showLoading({
title: '订单正在处理中...',
})
setTimeout(function () {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function () {
wx.hideLoading();
}, 2000);
}
},
fail: res => {
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', that, orderGroupId);
that.setData({
showbutton: false,
canSpell: true,
canBuyIf: true
})
return;
},
complete: res => { }
if (err.code == 2011) {
wx.showToast({
title: "商户信息没找到",
image: './../../../assets/images/fail.png',
duration: 2000,
mask: false
});
/// End payment --------
})
.catch(err => {
that.setData({
canSpell: true,
canBuyIf: true
})
} 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,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
that.setData({
canSpell: false
})
wx.showLoading({
title: '订单正在处理中...',
})
setTimeout(function() {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function() {
wx.hideLoading();
}, 2000);
}
},
fail: res => {
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', that, orderGroupId);
that.setData({
showbutton: false,
canSpell: true,
canBuyIf: true
})
return;
},
complete: res => {}
});
/// End payment --------
})
.catch(err => {
that.setData({
canSpell: true,
canBuyIf: true
})
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
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
})
}
})

})
})
.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
})
}
})
},
/**
* 生命周期函数--监听页面显示
@@ -769,23 +791,23 @@ Page({
*/
onPullDownRefresh: function(e) {
let that = this;
console.log(this.data.couponId,222)
console.log(this.data.couponId, 222)
that.getDetail(that.data.couponChannelId);
if (that.data.couponId) {
that.getOneSpell(that.data.couponId)
that.getOneSpell(that.data.couponId)
}
},
onShareAppMessage: function (options) {
onShareAppMessage: function(options) {
console.log(options)
var that = this;
var shareObj = {
title: that.data.data.title,
path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}&couponId=${that.data.data.couponId}&spellGroup=spellGroup`,
success: function (res) {
if (res.errMsg == 'shareAppMessage:ok') { }
success: function(res) {
if (res.errMsg == 'shareAppMessage:ok') {}
},
fail: function (error) {
if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { }
fail: function(error) {
if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {}
}
};
// 来自页面内的按钮的转发


+ 129
- 107
pages/spellGroup/paySpellGroup/index.js Ver fichero

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

/**
@@ -29,7 +32,7 @@ Page({
isMyself: false,
showErr: false,
showAlert: false,
disabled:false
disabled: false
},
gotoAgain() {
let data = this.data.data;
@@ -37,13 +40,13 @@ Page({
url: `/pages/spellGroup/mySpellGroup/index?couponId=${data.couponId}&couponChannelId=${data.couponChannelId}`,
})
},
getUserInfo: function () {
getUserInfo: function() {
let that = this;
// 获取用户信息
Http.get({
url: config.api.getScore,
data: {}
})
url: config.api.getScore,
data: {}
})
.then(res => {
console.log(res)
that.setData({
@@ -52,7 +55,7 @@ Page({
})
})
},
gotoIndex(){
gotoIndex() {
wx.reLaunch({
url: '/pages/index/index',
})
@@ -65,35 +68,54 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
paramData: options
})
this.getUserInfo();
if (options.orderGroupId){
if (options.orderId && options.couponId){
this.getDetail(options);
onLoad: function(options) {
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}

// 关闭来自于左上角的分享
wx.hideShareMenu()
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus,
data: {}
}).then(res => {
this.setData({
paramData: options
})
this.getUserInfo();
if (options.orderGroupId) {
if (options.orderId && options.couponId) {
this.getDetail(options);
}
}
// 关闭来自于左上角的分享
wx.hideShareMenu()
}).catch(res => {
wx.redirectTo({
url: `/pages/getphoneInfo/index`
});
})
}).catch(res => {
wx.redirectTo({
url: `/pages/getuserinfo/index`
})
})
},
/**
* 去拼团
*/
goToOrderGroup(orderId, orderGroupId, _this){
goToOrderGroup(orderId, orderGroupId, _this) {
console.log(22222222)
let that = this;
// 支付成功
Http.post({
url: config.api.toOrderGroup,
data: {
id: orderGroupId,
orderId,
couponId: _this.data.data.couponId
}
})
url: config.api.toOrderGroup,
data: {
id: orderGroupId,
orderId,
couponId: _this.data.data.couponId
}
})
.then(res => {
wx.redirectTo({
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.paramData.couponId}&orderGroupId=${res.data.orderGroupId}&couponChannelId=${_this.data.paramData.couponChannelId}`
@@ -108,18 +130,18 @@ Page({
* 支付订单更新
*/
payOrderUpdate: (orderId, payOrderId, status, reason, _this, orderGroupId) => {
console.log(orderGroupId,7777)
console.log(orderGroupId, 7777)
let that = _this;
// 支付成功
Http.post({
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
.then(res => {
wx.hideLoading()
that.setData({
@@ -131,11 +153,11 @@ Page({
})
return;
}
if (orderGroupId==undefined){
if (orderGroupId == undefined) {
wx.navigateTo({
url: '/pages/order/detail/index?orderId='+res.data.id,
url: '/pages/order/detail/index?orderId=' + res.data.id,
})
}else{
} else {
_this.goToOrderGroup(orderId, res.data.orderGroupId, _this)
}
})
@@ -144,80 +166,80 @@ Page({
that.setData({
disabled: false
})
if (err.code!=12002){
setTimeout(function () {
if (err.code != 12002) {
setTimeout(function() {
_this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId);
}, 2000)
}
})
},
gotoPay(){
let that=this;
gotoPay() {
let that = this;
wx.showLoading({
title: '支付创建中...',
})
that.setData({
disabled:true
disabled: true
})
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: that.data.paramData.orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
wx.showLoading({
title: '订单正在处理中...',
})
setTimeout(function () {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.paramData.orderId, payOrderId, 1, '', that, 0);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function () {
wx.hideLoading();
}, 2000);
}
},
fail: res => {
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.paramData.orderId, payOrderId, 2, '', that, 0);
that.setData({
showbutton: false,
canSpell: true,
canBuyIf: true,
disabled: false
})
return;
},
complete: res => { }
});
/// End payment --------
})
.catch(err => {
that.setData({
canSpell: true,
canBuyIf: true,
disabled: false
url: config.api.payOrderCreate,
data: {
orderId: that.data.paramData.orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
wx.showLoading({
title: '订单正在处理中...',
})
setTimeout(function() {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.paramData.orderId, payOrderId, 1, '', that, 0);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function() {
wx.hideLoading();
}, 2000);
}
},
fail: res => {
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.paramData.orderId, payOrderId, 2, '', that, 0);
that.setData({
showbutton: false,
canSpell: true,
canBuyIf: true,
disabled: false
})
return;
},
complete: res => {}
});
/// End payment --------
})
.catch(err => {
that.setData({
canSpell: true,
canBuyIf: true,
disabled: false
})
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
},
/**
* 去使用
@@ -243,7 +265,7 @@ Page({
/**
* 获取券详情信息
*/
getDetail(){
getDetail() {
let that = this;
Http.get({
url: config.api.couponDetail,
@@ -261,7 +283,7 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
this.setData({
showTime: true
})
@@ -270,7 +292,7 @@ Page({
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
this.setData({
showTime: false
})
@@ -279,16 +301,16 @@ Page({
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
this.setData({
showTime: false
})
},
},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
this.getDetail(this.data.paramData);
},
})

+ 1
- 1
project.config.json Ver fichero

@@ -32,7 +32,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.5.0",
"appid": "wxfa336cad86ed598d",
"appid": "wx453ae0d37f3550d0",
"projectname": "oldC",
"isGameTourist": false,
"simulatorType": "wechat",


Cargando…
Cancelar
Guardar