@@ -1,17 +1,17 @@ | |||||
{ | { | ||||
"ext": { | "ext": { | ||||
"attr": { | "attr": { | ||||
"configUrl": "https://c.malls.iformall.com/C/api" | |||||
"configUrl": "https://ctest.malls.iformall.com/C/api" | |||||
}, | }, | ||||
"name": "创美优团", | |||||
"weappId": "tt15d463698aebb83b01" | |||||
"name": "富茂券券", | |||||
"weappId": "ttef6599d8705b49b101" | |||||
}, | }, | ||||
"window": { | "window": { | ||||
"backgroundTextStyle": "light", | "backgroundTextStyle": "light", | ||||
"navigationBarTextStyle": "black", | "navigationBarTextStyle": "black", | ||||
"navigationBarBackgroundColor": "#fff" | "navigationBarBackgroundColor": "#fff" | ||||
}, | }, | ||||
"extAppid": "tt15d463698aebb83b01", | |||||
"extAppid": "ttef6599d8705b49b101", | |||||
"extEnable": true, | "extEnable": true, | ||||
"directCommit": false, | "directCommit": false, | ||||
"networkTimeout": { | "networkTimeout": { | ||||
@@ -54,7 +54,9 @@ Page({ | |||||
getSupId(id) { | getSupId(id) { | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getSpuid, | url: config.api.getSpuid, | ||||
data: { id: id } | |||||
data: { | |||||
id: id | |||||
} | |||||
}).then(res => { | }).then(res => { | ||||
if (res.data) { | if (res.data) { | ||||
this.setData({ | this.setData({ | ||||
@@ -98,15 +100,15 @@ Page({ | |||||
success: (res) => { | success: (res) => { | ||||
tt.reLaunch({ | tt.reLaunch({ | ||||
url: "/index/index", | url: "/index/index", | ||||
success(res) { | |||||
console.log(`${res}`); | |||||
app.globalData.selected = 0 | |||||
}, | |||||
fail(err) { | |||||
console.log(`navigateTo调用失败`,err); | |||||
}, | |||||
success(res) { | |||||
console.log(`${res}`); | |||||
app.globalData.selected = 0 | |||||
}, | |||||
fail(err) { | |||||
console.log(`navigateTo调用失败`, err); | |||||
}, | |||||
}); | }); | ||||
}, | }, | ||||
fail: (res) => { | fail: (res) => { | ||||
@@ -114,7 +116,7 @@ Page({ | |||||
}); | }); | ||||
}, | }, | ||||
getCouponPriceAndStock(couponChannelId) {//获取券价格与库存 | |||||
getCouponPriceAndStock(couponChannelId) { //获取券价格与库存 | |||||
Http.get({ | Http.get({ | ||||
url: config.api.couponPriceAndStock, | url: config.api.couponPriceAndStock, | ||||
data: { | data: { | ||||
@@ -132,7 +134,7 @@ Page({ | |||||
let that = this; | let that = this; | ||||
let data = {}; | let data = {}; | ||||
that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存 | |||||
that.getCouponPriceAndStock(couponChannelId); //获取券价格和库存 | |||||
if (that.data.couponIds) { | if (that.data.couponIds) { | ||||
data.couponId = couponChannelId | data.couponId = couponChannelId | ||||
} else { | } else { | ||||
@@ -285,20 +287,20 @@ Page({ | |||||
}) | }) | ||||
}, | }, | ||||
/** | /** | ||||
* 支付订单更新 | |||||
*/ | |||||
* 支付订单更新 | |||||
*/ | |||||
payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => { | payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => { | ||||
let that = this; | let that = this; | ||||
// 支付成功 | // 支付成功 | ||||
Http.post({ | Http.post({ | ||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
composeOrderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
composeOrderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
tt.hideLoading() | tt.hideLoading() | ||||
// 有价券 | // 有价券 | ||||
@@ -368,7 +370,7 @@ Page({ | |||||
success: function (res1) { | success: function (res1) { | ||||
if (res1.confirm) { | if (res1.confirm) { | ||||
if (that.data.composeOrderType > 0) {//券包 | |||||
if (that.data.composeOrderType > 0) { //券包 | |||||
tt.navigateTo({ | tt.navigateTo({ | ||||
url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`, | url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`, | ||||
}) | }) | ||||
@@ -417,139 +419,153 @@ Page({ | |||||
}).then(res => { | }).then(res => { | ||||
// | // | ||||
// if (!tt.canIUse('createOrder') || that.data.data.type == 50 || that.data.priceAndStockObj.salePrice == 0) { | // if (!tt.canIUse('createOrder') || that.data.data.type == 50 || that.data.priceAndStockObj.salePrice == 0) { | ||||
//积分券和免费券 | |||||
// 发起砍价 | |||||
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 = { | |||||
//积分券和免费券 | |||||
// 发起砍价 | |||||
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, | |||||
} | |||||
} | |||||
console.log(data, "data") | |||||
let url = "" | |||||
let tempObj; | |||||
let tempArr = [] | |||||
if (that.data.data.type == 12) { | |||||
url = config.api.couponPackageSave | |||||
tempObj = { | |||||
signleOrder: { | |||||
couponChannelId: "" + that.data.couponChannelId, | couponChannelId: "" + that.data.couponChannelId, | ||||
couponId: "" + that.data.couponId, | couponId: "" + that.data.couponId, | ||||
formId: "" + that.data.formId, | formId: "" + that.data.formId, | ||||
} | |||||
} | |||||
console.log(data, "data") | |||||
let url = "" | |||||
let tempObj; | |||||
let tempArr = [] | |||||
if (that.data.data.type == 12) { | |||||
url = config.api.couponPackageSave | |||||
tempObj = { | |||||
signleOrder: { | |||||
couponChannelId: "" + that.data.couponChannelId, | |||||
couponId: "" + that.data.couponId, | |||||
formId: "" + that.data.formId, | |||||
}, | |||||
count: "1" | |||||
} | |||||
tempArr.push(tempObj) | |||||
} else { | |||||
url = config.api.orderSave | |||||
}, | |||||
count: "1" | |||||
} | } | ||||
/** | |||||
* orderSave 下单 | |||||
*/ | |||||
Http.post({ | |||||
url: url, | |||||
data: that.data.data.type == 12 ? JSON.stringify(tempArr) : data | |||||
}).then(res => { | |||||
if (discount != 'discount') { | |||||
if (typeof (res) != "undefined") { | |||||
let orderId = "" + res.data.mainOrderId; | |||||
that.setData({ | |||||
orderId: orderId, | |||||
composeOrderType: res.data.composeOrderType | |||||
}); | |||||
if (res.data.payment > 0) { | |||||
// 支付金额不为0 | |||||
if (tt.canIUse('createOrder')) { | |||||
Http.post({ | |||||
url: config.api.payOrderCreate_2, | |||||
data: { | |||||
orderId: orderId, | |||||
composeOrderType: res.data.composeOrderType | |||||
} | |||||
}).then(res => { | |||||
console.log(res,"789789"); | |||||
let tempCallbackData = res.data.callbackData | |||||
// tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id | |||||
let options = { | |||||
callbackData: tempCallbackData, | |||||
goodsList: res.data.goodsList, | |||||
payment: res.data.payment, | |||||
success: res => { | |||||
tempArr.push(tempObj) | |||||
} else { | |||||
url = config.api.orderSave | |||||
} | |||||
/** | |||||
* orderSave 下单 | |||||
*/ | |||||
Http.post({ | |||||
url: url, | |||||
data: that.data.data.type == 12 ? JSON.stringify(tempArr) : data | |||||
}).then(res => { | |||||
if (discount != 'discount') { | |||||
if (typeof (res) != "undefined") { | |||||
let orderId = "" + res.data.mainOrderId; | |||||
that.setData({ | |||||
orderId: orderId, | |||||
composeOrderType: res.data.composeOrderType | |||||
}); | |||||
if (res.data.payment > 0) { | |||||
// 支付金额不为0 | |||||
if (tt.canIUse('createOrder')) { | |||||
Http.post({ | |||||
url: config.api.payOrderCreate_2, | |||||
data: { | |||||
orderId: orderId, | |||||
composeOrderType: res.data.composeOrderType | |||||
} | |||||
}).then(res => { | |||||
console.log(res, "789789"); | |||||
let tempCallbackData = { | |||||
composeOrderId: res.data.outOrderNo | |||||
} | |||||
// tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id | |||||
let options = { | |||||
callbackData: tempCallbackData, | |||||
goodsList: res.data.goodsList, | |||||
payment: res.data.payment, | |||||
success: res => { | |||||
tt.hideLoading(); | |||||
that.setData({ | |||||
showbutton: false, | |||||
}) | |||||
const { | |||||
orderId, | |||||
outOrderNo | |||||
} = res; | |||||
that.setData({ | |||||
orderId, | |||||
outOrderNo | |||||
}); | |||||
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); | |||||
}, | |||||
fail: res => { | |||||
const { | |||||
orderId, | |||||
outOrderNo, | |||||
errNo, | |||||
errMsg, | |||||
errLogId | |||||
} = res; | |||||
if (errLogId) { | |||||
tt.hideLoading(); | tt.hideLoading(); | ||||
that.setData({ | that.setData({ | ||||
showbutton: false, | showbutton: false, | ||||
}) | }) | ||||
const { orderId, outOrderNo } = res; | |||||
that.setData({ orderId, outOrderNo }); | |||||
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); | |||||
}, | |||||
fail: res => { | |||||
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; | |||||
if (errLogId) { | |||||
tt.hideLoading(); | |||||
that.setData({ | |||||
showbutton: false, | |||||
}) | |||||
console.log('预下单失败', errNo, errMsg, errLogId); | |||||
let tempErrmsg = errMsg.split('开发者拒绝交易:'); | |||||
tt.showToast({ | |||||
title: tempErrmsg[tempErrmsg.length - 1], | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
} | |||||
if (orderId || outOrderNo) { | |||||
tt.hideLoading(); | |||||
that.setData({ | |||||
showbutton: false, | |||||
}) | |||||
console.log('支付失败', errNo, errMsg, orderId, outOrderNo); | |||||
console.log(that.payOrderUpdate, "payOrderUpdate"); | |||||
tt.showToast({ | |||||
title: "取消支付", | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail') | |||||
} | |||||
}, | |||||
} | |||||
console.log(options, "options"); | |||||
tt.createOrder(options) | |||||
}) | |||||
} else {//不支持2.0支付 | |||||
/** | |||||
console.log('预下单失败', errNo, errMsg, errLogId); | |||||
let tempErrmsg = errMsg.split('开发者拒绝交易:'); | |||||
tt.showToast({ | |||||
title: tempErrmsg[tempErrmsg.length - 1], | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
} | |||||
if (orderId || outOrderNo) { | |||||
tt.hideLoading(); | |||||
that.setData({ | |||||
showbutton: false, | |||||
}) | |||||
console.log('支付失败', errNo, errMsg, orderId, outOrderNo); | |||||
console.log(that.payOrderUpdate, "payOrderUpdate"); | |||||
tt.showToast({ | |||||
title: "取消支付", | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail') | |||||
} | |||||
}, | |||||
} | |||||
console.log(options, "options"); | |||||
tt.createOrder(options) | |||||
}) | |||||
} else { //不支持2.0支付 | |||||
/** | |||||
* 支付订单创建 | * 支付订单创建 | ||||
*/ | */ | ||||
tt.showToast({ | |||||
title: '请升级抖音', // 内容 | |||||
icon: "none" | |||||
}); | |||||
return | |||||
Http.post({ | |||||
tt.showToast({ | |||||
title: '请升级抖音', // 内容 | |||||
icon: "none" | |||||
}); | |||||
return | |||||
Http.post({ | |||||
url: config.api.payOrderCreate, | url: config.api.payOrderCreate, | ||||
data: { | data: { | ||||
orderId: orderId, | orderId: orderId, | ||||
@@ -586,8 +602,7 @@ Page({ | |||||
}) | }) | ||||
} | } | ||||
} | } | ||||
} | |||||
else if (res.code === 1) { | |||||
} else if (res.code === 1) { | |||||
that.setData({ | that.setData({ | ||||
showbutton: false | showbutton: false | ||||
}) | }) | ||||
@@ -647,66 +662,66 @@ Page({ | |||||
}) | }) | ||||
return; | return; | ||||
}, | }, | ||||
complete: res => { } | |||||
complete: res => {} | |||||
}); | }); | ||||
/// End payment -------- | /// End payment -------- | ||||
}) | }) | ||||
.catch(err => { | |||||
tt.hideLoading(); | |||||
tt.showToast({ | |||||
title: err.message, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
}) | |||||
} | |||||
} else { | |||||
// 免费券 | |||||
that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType); | |||||
if (that.data.cardType == 100) { | |||||
tt.setStorage({ | |||||
key: 'couponNum2', | |||||
data: "couponNum2" | |||||
}) | |||||
} else if (that.data.data.type != "5" && that.data.cardType != 100) { | |||||
tt.setStorage({ | |||||
key: 'couponNum', | |||||
data: "couponNum" | |||||
.catch(err => { | |||||
tt.hideLoading(); | |||||
tt.showToast({ | |||||
title: err.message, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
}) | }) | ||||
} | |||||
} | } | ||||
} | |||||
} else { | |||||
if (res) { | |||||
tt.navigateTo({ | |||||
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.mainOrderId}&composeOrderType=${res.data.composeOrderType}`, | |||||
}) | |||||
} else { | |||||
// 免费券 | |||||
that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType); | |||||
if (that.data.cardType == 100) { | |||||
tt.setStorage({ | |||||
key: 'couponNum2', | |||||
data: "couponNum2" | |||||
}) | |||||
} else if (that.data.data.type != "5" && that.data.cardType != 100) { | |||||
tt.setStorage({ | |||||
key: 'couponNum', | |||||
data: "couponNum" | |||||
}) | |||||
} | |||||
} | } | ||||
} | } | ||||
}).catch(err => { | |||||
tt.hideLoading(); | |||||
that.setData({ | |||||
showbutton: false, | |||||
}) | |||||
if (err.code == 3012) { | |||||
that.getUnPaidOrder(that.data.couponId); | |||||
} else { | |||||
tt.showToast({ | |||||
title: err.message ? err.message : err.data, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
success(res) { | |||||
console.log(res); | |||||
}, | |||||
fail(res) { | |||||
console.log("showToast 调用失败", res); | |||||
}, | |||||
}); | |||||
} else { | |||||
if (res) { | |||||
tt.navigateTo({ | |||||
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.mainOrderId}&composeOrderType=${res.data.composeOrderType}`, | |||||
}) | |||||
} | } | ||||
} | |||||
}).catch(err => { | |||||
tt.hideLoading(); | |||||
that.setData({ | |||||
showbutton: false, | |||||
}) | }) | ||||
if (err.code == 3012) { | |||||
that.getUnPaidOrder(that.data.couponId); | |||||
} else { | |||||
tt.showToast({ | |||||
title: err.message ? err.message : err.data, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
success(res) { | |||||
console.log(res); | |||||
}, | |||||
fail(res) { | |||||
console.log("showToast 调用失败", res); | |||||
}, | |||||
}); | |||||
} | |||||
}) | |||||
// } else { | // } else { | ||||
// //有价券 | // //有价券 | ||||
// console.log(tt.canIUse('createOrder'), "是否支持2.0js-api"); | // console.log(tt.canIUse('createOrder'), "是否支持2.0js-api"); | ||||
@@ -851,12 +866,12 @@ Page({ | |||||
* 将值传到用户手机号授权的页面 | * 将值传到用户手机号授权的页面 | ||||
* | * | ||||
*/ | */ | ||||
// tt.navigateTo({ | |||||
// url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` | |||||
// }); | |||||
this.setData({ | |||||
showPhoem:true | |||||
}) | |||||
tt.navigateTo({ | |||||
url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr` | |||||
}); | |||||
// this.setData({ | |||||
// showPhoem: true | |||||
// }) | |||||
} else if (err.code == 11006) { | } else if (err.code == 11006) { | ||||
// 用户手机已加密 | // 用户手机已加密 | ||||
tt.navigateTo({ | tt.navigateTo({ | ||||
@@ -12,10 +12,10 @@ Page({ | |||||
data: { | data: { | ||||
curHtml: '', | curHtml: '', | ||||
showIdFalg: false, | showIdFalg: false, | ||||
outOrderNo: '',//支付2.0继续支付id | |||||
payOrderNo: "",//评价订单id | |||||
evaluateFlag: false,//控制评价显隐藏 | |||||
serviceUrl: '',//客服外部链接 | |||||
outOrderNo: '', //支付2.0继续支付id | |||||
payOrderNo: "", //评价订单id | |||||
evaluateFlag: false, //控制评价显隐藏 | |||||
serviceUrl: '', //客服外部链接 | |||||
dynamicRq: "", | dynamicRq: "", | ||||
expiredSeconds: 0, | expiredSeconds: 0, | ||||
showhieRq: false, | showhieRq: false, | ||||
@@ -52,18 +52,30 @@ Page({ | |||||
orderFlag: false, //判断是不是线上配送 | orderFlag: false, //判断是不是线上配送 | ||||
}, | }, | ||||
handleRefund(event) { | handleRefund(event) { | ||||
const { status, result } = event.detail; | |||||
const { | |||||
status, | |||||
result | |||||
} = event.detail; | |||||
if (status === 'success') { | if (status === 'success') { | ||||
const { refundId, outRefundNo } = result; | |||||
console.log(refundId, outRefundNo ); | |||||
const { | |||||
refundId, | |||||
outRefundNo | |||||
} = result; | |||||
console.log(refundId, outRefundNo); | |||||
} else { | } else { | ||||
const { errMsg } = result; | |||||
const { | |||||
errMsg | |||||
} = result; | |||||
console.log(errMsg); | console.log(errMsg); | ||||
} | } | ||||
}, | }, | ||||
applyRefund(event) { | applyRefund(event) { | ||||
const { orderId } = event.detail; | |||||
const extra = { orderId }; // 开发者需要透传的参数,可自定义内容 | |||||
const { | |||||
orderId | |||||
} = event.detail; | |||||
const extra = { | |||||
orderId | |||||
}; // 开发者需要透传的参数,可自定义内容 | |||||
return new Promise(resolve => { | return new Promise(resolve => { | ||||
resolve(extra); | resolve(extra); | ||||
}); | }); | ||||
@@ -141,7 +153,7 @@ Page({ | |||||
}, | }, | ||||
}); | }); | ||||
}, | }, | ||||
refund() {//退款 | |||||
refund() { //退款 | |||||
Http.post({ | Http.post({ | ||||
url: config.api.refund, | url: config.api.refund, | ||||
data: { | data: { | ||||
@@ -186,7 +198,7 @@ Page({ | |||||
console.log(`showModal调用失败`); | console.log(`showModal调用失败`); | ||||
}, | }, | ||||
}); | }); | ||||
} else if (this_.data.order.couponOrderStatus == 3) {//退款中 | |||||
} else if (this_.data.order.couponOrderStatus == 3) { //退款中 | |||||
tt.navigateTo({ | tt.navigateTo({ | ||||
url: `/pages/refund/refund?id=${this.data.order.id}`, | url: `/pages/refund/refund?id=${this.data.order.id}`, | ||||
success: (res) => { | success: (res) => { | ||||
@@ -294,7 +306,7 @@ Page({ | |||||
createDate: createDate, | createDate: createDate, | ||||
composeOrderType: tempData.composeOrderType, | composeOrderType: tempData.composeOrderType, | ||||
contentType: tempData.contentType ? tempData.contentType : 0, | contentType: tempData.contentType ? tempData.contentType : 0, | ||||
orderFlag: tempData.type == 11 ? true : false,//判断是不是线上配送 | |||||
orderFlag: tempData.type == 11 ? true : false, //判断是不是线上配送 | |||||
}) | }) | ||||
if (tempData.couponOrderId) { //0未付款 1已支付 2已取消 3退款中 4已退款 | if (tempData.couponOrderId) { //0未付款 1已支付 2已取消 3退款中 4已退款 | ||||
that.setRq() | that.setRq() | ||||
@@ -302,29 +314,29 @@ Page({ | |||||
let setInter = setInterval(() => { | let setInter = setInterval(() => { | ||||
if (tempData.couponOrderStatus == 0) { | if (tempData.couponOrderStatus == 0) { | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getStatus, | |||||
data: { | |||||
couponOrderId: tempData.couponOrderId | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | |||||
couponOrderStatus: res.data.CouponOrderStatus | |||||
}); | |||||
if (res.data.CouponOrderStatus == 1 || res.data.CouponOrderStatus == 3) { | |||||
/** | |||||
* 动态改变上一级页面的核销状态 | |||||
*/ | |||||
// that.getStaticGame() | |||||
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |||||
clearInterval(that.data.setInter); | |||||
clearInterval(that.data.templTiem); | |||||
that.updetail() | |||||
url: config.api.getStatus, | |||||
data: { | |||||
couponOrderId: tempData.couponOrderId | |||||
} | |||||
}).then(res => { | |||||
console.log(res); | |||||
that.setData({ | that.setData({ | ||||
mystatus: res.data.CouponOrderStatus | |||||
couponOrderStatus: res.data.CouponOrderStatus | |||||
}); | }); | ||||
} | |||||
}) | |||||
if (res.data.CouponOrderStatus == 1 || res.data.CouponOrderStatus == 3) { | |||||
/** | |||||
* 动态改变上一级页面的核销状态 | |||||
*/ | |||||
// that.getStaticGame() | |||||
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去 | |||||
clearInterval(that.data.setInter); | |||||
clearInterval(that.data.templTiem); | |||||
that.updetail() | |||||
that.setData({ | |||||
mystatus: res.data.CouponOrderStatus | |||||
}); | |||||
} | |||||
}) | |||||
.catch(err => { | .catch(err => { | ||||
tt.showToast({ | tt.showToast({ | ||||
title: err.errMsg, | title: err.errMsg, | ||||
@@ -339,8 +351,8 @@ Page({ | |||||
setInter: setInter | setInter: setInter | ||||
}) | }) | ||||
} | } | ||||
if (tempData.couponOrderStatus && tempData.couponOrderStatus == 1) {//核销后 | |||||
that.goIfEvaluate()//判断订单是否能评价 | |||||
if (tempData.couponOrderStatus && tempData.couponOrderStatus == 1) { //核销后 | |||||
that.goIfEvaluate() //判断订单是否能评价 | |||||
} | } | ||||
}).catch(error => { | }).catch(error => { | ||||
console.log(error, "error"); | console.log(error, "error"); | ||||
@@ -392,9 +404,9 @@ Page({ | |||||
let that = this; | let that = this; | ||||
// 获取用户信息 | // 获取用户信息 | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getScore, | |||||
data: {} | |||||
}) | |||||
url: config.api.getScore, | |||||
data: {} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
console.log(res) | console.log(res) | ||||
that.setData({ | that.setData({ | ||||
@@ -440,7 +452,7 @@ Page({ | |||||
_this.setData({ | _this.setData({ | ||||
showhieRq: false, | showhieRq: false, | ||||
}) | }) | ||||
Http.get({//获取动态二维码 | |||||
Http.get({ //获取动态二维码 | |||||
url: config.api.dynamicId, | url: config.api.dynamicId, | ||||
data: { | data: { | ||||
couponOrderId: _this.data.order.couponOrderId | couponOrderId: _this.data.order.couponOrderId | ||||
@@ -541,20 +553,20 @@ Page({ | |||||
getStaticGame(token) { | getStaticGame(token) { | ||||
let _this = this; | let _this = this; | ||||
Http.get({ | Http.get({ | ||||
url: config.api.getGame, | |||||
data: { | |||||
triggleAction: 3 // 购买触发 | |||||
} | |||||
}).then(res => { | |||||
if (res.data.id) { | |||||
url: config.api.getGame, | |||||
data: { | |||||
triggleAction: 3 // 购买触发 | |||||
} | |||||
}).then(res => { | |||||
if (res.data.id) { | |||||
_this.setData({ | |||||
showIf: true | |||||
}) | |||||
} | |||||
_this.setData({ | _this.setData({ | ||||
showIf: true | |||||
staticGamedata: res.data | |||||
}) | }) | ||||
} | |||||
_this.setData({ | |||||
staticGamedata: res.data | |||||
}) | }) | ||||
}) | |||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | console.log(err); | ||||
}) | }) | ||||
@@ -563,7 +575,9 @@ Page({ | |||||
let _this = this | let _this = this | ||||
tt.rateAwemeOrder({ | tt.rateAwemeOrder({ | ||||
orderId: _this.data.payOrderNo, | orderId: _this.data.payOrderNo, | ||||
success({ result }) { | |||||
success({ | |||||
result | |||||
}) { | |||||
console.log(result); | console.log(result); | ||||
if (result) { | if (result) { | ||||
tt.navigateBack({ | tt.navigateBack({ | ||||
@@ -596,7 +610,9 @@ Page({ | |||||
}).then(res => { | }).then(res => { | ||||
tt.canRateAwemeOrders({ | tt.canRateAwemeOrders({ | ||||
orderIds: [res.data.payOrderNo], | orderIds: [res.data.payOrderNo], | ||||
success({ result }) { | |||||
success({ | |||||
result | |||||
}) { | |||||
console.log("result", result); | console.log("result", result); | ||||
_this.setData({ | _this.setData({ | ||||
evaluateFlag: result[0], | evaluateFlag: result[0], | ||||
@@ -631,7 +647,7 @@ Page({ | |||||
}); | }); | ||||
tt.hideShareMenu() | tt.hideShareMenu() | ||||
if (options.cardIf) {//转赠 展示不需 | |||||
if (options.cardIf) { //转赠 展示不需 | |||||
that.setData({ | that.setData({ | ||||
cardIf: true | cardIf: true | ||||
}) | }) | ||||
@@ -650,7 +666,7 @@ Page({ | |||||
}) | }) | ||||
that.updetail() | that.updetail() | ||||
}, | }, | ||||
getSeUrl() {//获取客服链接 | |||||
getSeUrl() { //获取客服链接 | |||||
const openId = tt.getStorageSync('openId'); | const openId = tt.getStorageSync('openId'); | ||||
Http.post({ | Http.post({ | ||||
url: config.api.getServiceUrl, | url: config.api.getServiceUrl, | ||||
@@ -686,13 +702,13 @@ Page({ | |||||
let that = this; | let that = this; | ||||
// 支付成功 | // 支付成功 | ||||
Http.post({ | Http.post({ | ||||
url: config.api.toOrderGroup, | |||||
data: { | |||||
id: orderGroupId, | |||||
orderId, | |||||
couponId: _this.data.order.productId | |||||
} | |||||
}) | |||||
url: config.api.toOrderGroup, | |||||
data: { | |||||
id: orderGroupId, | |||||
orderId, | |||||
couponId: _this.data.order.productId | |||||
} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
tt.redirectTo({ | tt.redirectTo({ | ||||
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}` | url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}` | ||||
@@ -719,7 +735,7 @@ Page({ | |||||
// if (true) {//兼容不支持支付2.0 js-api !tt.canIUse('createOrder') | // if (true) {//兼容不支持支付2.0 js-api !tt.canIUse('createOrder') | ||||
if (that.data.order.payment > 0) { | if (that.data.order.payment > 0) { | ||||
if (tt.canIUse('createOrder')) {//支付2.0 js-api | |||||
if (tt.canIUse('createOrder')) { //支付2.0 js-api | |||||
const outOrderNo = that.data.outOrderNo | const outOrderNo = that.data.outOrderNo | ||||
console.log(outOrderNo, "outOrderNo"); | console.log(outOrderNo, "outOrderNo"); | ||||
Http.post({ | Http.post({ | ||||
@@ -731,7 +747,9 @@ Page({ | |||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
if (res.data.createPay) { | if (res.data.createPay) { | ||||
let tempCallbackData = res.data.callbackData | |||||
let tempCallbackData = { | |||||
composeOrderId: res.data.outOrderNo | |||||
} | |||||
// tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id | // tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id | ||||
let options = { | let options = { | ||||
callbackData: tempCallbackData, | callbackData: tempCallbackData, | ||||
@@ -742,12 +760,21 @@ Page({ | |||||
that.setData({ | that.setData({ | ||||
showbutton: false, | showbutton: false, | ||||
}) | }) | ||||
const { orderId, outOrderNo } = res; | |||||
const { | |||||
orderId, | |||||
outOrderNo | |||||
} = res; | |||||
// that.setData({ orderId, outOrderNo }); | // that.setData({ orderId, outOrderNo }); | ||||
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); | that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, ''); | ||||
}, | }, | ||||
fail: res => { | fail: res => { | ||||
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; | |||||
const { | |||||
orderId, | |||||
outOrderNo, | |||||
errNo, | |||||
errMsg, | |||||
errLogId | |||||
} = res; | |||||
if (errLogId) { | if (errLogId) { | ||||
tt.hideLoading(); | tt.hideLoading(); | ||||
that.setData({ | that.setData({ | ||||
@@ -795,7 +822,13 @@ Page({ | |||||
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that); // 支付成功 | that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that); // 支付成功 | ||||
}, | }, | ||||
fail: res => { | fail: res => { | ||||
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res; | |||||
const { | |||||
orderId, | |||||
outOrderNo, | |||||
errNo, | |||||
errMsg, | |||||
errLogId | |||||
} = res; | |||||
if (errLogId) { | if (errLogId) { | ||||
console.log('查询订单信息失败', errNo, errMsg, errLogId); | console.log('查询订单信息失败', errNo, errMsg, errLogId); | ||||
that.setData({ | that.setData({ | ||||
@@ -833,11 +866,11 @@ Page({ | |||||
icon: "none" | icon: "none" | ||||
}); | }); | ||||
}) | }) | ||||
} else {//不支持支付2.0 js-api | |||||
} else { //不支持支付2.0 js-api | |||||
tt.showToast({ | tt.showToast({ | ||||
title: '请升级抖音', // 内容 | title: '请升级抖音', // 内容 | ||||
icon: "none" | icon: "none" | ||||
}); | |||||
}); | |||||
return | return | ||||
// 支付金额不为0 | // 支付金额不为0 | ||||
Http.post({ | Http.post({ | ||||
@@ -979,14 +1012,14 @@ Page({ | |||||
payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => { | payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => { | ||||
// 支付成功 | // 支付成功 | ||||
Http.post({ | Http.post({ | ||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
composeOrderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
url: config.api.payOrderUpdate, | |||||
data: { | |||||
payOrderId: payOrderId, | |||||
composeOrderId: orderId, | |||||
status: status, | |||||
reason: reason | |||||
} | |||||
}) | |||||
.then(res => { | .then(res => { | ||||
tt.hideLoading(); | tt.hideLoading(); | ||||
_this.setData({ | _this.setData({ | ||||
@@ -1045,5 +1078,4 @@ Page({ | |||||
clearInterval(that.data.setInter); | clearInterval(that.data.setInter); | ||||
clearInterval(that.data.templTiem); | clearInterval(that.data.templTiem); | ||||
}, | }, | ||||
}); | |||||
}); |