Преглед на файлове

商品详情、支付、退款

soldDate
HolyKnightIX преди 2 години
родител
ревизия
8c457a6521
променени са 8 файла, в които са добавени 671 реда и са изтрити 515 реда
  1. +230
    -205
      pages/coupon/confirmation/confirmation.js
  2. +1
    -1
      pages/coupon/detail/index.js
  3. +125
    -84
      pages/order/detail/index.js
  4. +159
    -133
      pages/order/index/index.js
  5. +22
    -6
      pages/order/index/index.ttml
  6. +110
    -73
      pages/order/index/index.ttss
  7. +15
    -13
      pages/refund/refund.js
  8. +9
    -0
      project.config.json

+ 230
- 205
pages/coupon/confirmation/confirmation.js Целия файл

@@ -12,10 +12,18 @@ Page({
showPage: false,
data: {},
spuIdObj: {},
priceAndStockObj: {}
priceAndStockObj: {},
mallTenantId: ''
},
onLoad: function (options) {
console.log(options);

if (options.mallTenantId) {
this.setData({
mallTenantId: options.mallTenantId,
})
}

tt.showLoading({
title: "加载中..."
});
@@ -54,7 +62,9 @@ Page({
getSupId(id) {
Http.get({
url: config.api.getSpuid,
data: { id: id }
data: {
id: id
}
}).then(res => {
if (res.data) {
this.setData({
@@ -98,15 +108,15 @@ Page({
success: (res) => {
tt.reLaunch({
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) => {

@@ -114,11 +124,12 @@ Page({
});
},

getCouponPriceAndStock(couponChannelId) {//获取券价格与库存
getCouponPriceAndStock(couponChannelId) { //获取券价格与库存
Http.get({
url: config.api.couponPriceAndStock,
data: {
couponChannelId
couponChannelId,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
let tempBoj = JSON.parse(res.data)
@@ -132,7 +143,7 @@ Page({
let that = this;
let data = {};

that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存
that.getCouponPriceAndStock(couponChannelId); //获取券价格和库存
if (that.data.couponIds) {
data.couponId = couponChannelId
} else {
@@ -285,20 +296,20 @@ Page({
})
},
/**
* 支付订单更新
*/
* 支付订单更新
*/
payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => {
let that = this;
// 支付成功
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 => {
tt.hideLoading()
// 有价券
@@ -330,7 +341,8 @@ Page({
Http.get({
url: config.api.getUnPaidOrder,
data: {
couponId: couponId
couponId: couponId,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
that.setData({
@@ -368,13 +380,13 @@ Page({
success: function (res1) {
if (res1.confirm) {

if (that.data.composeOrderType > 0) {//券包
if (that.data.composeOrderType > 0) { //券包
tt.navigateTo({
url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`,
url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}&mallTenantId=${that.data.mallTenantId}`,
})
} else {
tt.navigateTo({
url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`,
url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}&mallTenantId=${that.data.mallTenantId}`,
})
}

@@ -408,7 +420,7 @@ Page({
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
token: app.globalData.token,
}
}).then(res => {
Http.get({
@@ -417,139 +429,153 @@ Page({
}).then(res => {
//
// 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,
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,
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
data.mallTenantId = that.data.mallTenantId || ''
}
/**
* 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,
mallTenantId: that.data.mallTenantId
}
}).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 => {
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();
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();
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,
data: {
orderId: orderId,
@@ -586,8 +612,7 @@ Page({
})
}
}
}
else if (res.code === 1) {
} else if (res.code === 1) {
that.setData({
showbutton: false
})
@@ -647,66 +672,66 @@ Page({
})
return;
},
complete: res => { }
complete: res => {}
});
/// 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 {
// //有价券
// console.log(tt.canIUse('createOrder'), "是否支持2.0js-api");
@@ -855,7 +880,7 @@ Page({
// url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr`
// });
this.setData({
showPhoem:true
showPhoem: true
})
} else if (err.code == 11006) {
// 用户手机已加密


+ 1
- 1
pages/coupon/detail/index.js Целия файл

@@ -417,7 +417,7 @@ Page({

gotopay: function (e) {
tt.navigateTo({
url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}`,
url: `/pages/coupon/confirmation/confirmation?couponChannelId=${this.data.couponChannelId}&mallTenantId=${this.data.mallTenantId}`,
})
return
},


+ 125
- 84
pages/order/detail/index.js Целия файл

@@ -12,10 +12,10 @@ Page({
data: {
curHtml: '',
showIdFalg: false,
outOrderNo: '',//支付2.0继续支付id
payOrderNo: "",//评价订单id
evaluateFlag: false,//控制评价显隐藏
serviceUrl: '',//客服外部链接
outOrderNo: '', //支付2.0继续支付id
payOrderNo: "", //评价订单id
evaluateFlag: false, //控制评价显隐藏
serviceUrl: '', //客服外部链接
dynamicRq: "",
expiredSeconds: 0,
showhieRq: false,
@@ -52,18 +52,30 @@ Page({
orderFlag: false, //判断是不是线上配送
},
handleRefund(event) {
const { status, result } = event.detail;
const {
status,
result
} = event.detail;
if (status === 'success') {
const { refundId, outRefundNo } = result;
console.log(refundId, outRefundNo );
const {
refundId,
outRefundNo
} = result;
console.log(refundId, outRefundNo);
} else {
const { errMsg } = result;
const {
errMsg
} = result;
console.log(errMsg);
}
},
applyRefund(event) {
const { orderId } = event.detail;
const extra = { orderId }; // 开发者需要透传的参数,可自定义内容
const {
orderId
} = event.detail;
const extra = {
orderId
}; // 开发者需要透传的参数,可自定义内容
return new Promise(resolve => {
resolve(extra);
});
@@ -132,7 +144,7 @@ Page({

goDetail() {
tt.navigateTo({
url: `/pages/coupon/detail/index?couponChannelId=${this.data.order.couponChannelId}`,
url: `/pages/coupon/detail/index?couponChannelId=${this.data.order.couponChannelId}&mallTenantId=${this.data.mallTenantId}`,
success: (res) => {

},
@@ -141,15 +153,16 @@ Page({
},
});
},
refund() {//退款
refund() { //退款
Http.post({
url: config.api.refund,
data: {
orderId: this.data.order.id
orderId: this.data.order.id,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
tt.navigateTo({
url: `/pages/refund/refund?id=${this.data.order.id}`,
url: `/pages/refund/refund?id=${this.data.order.id}&mallTenantId=${this.data.mallTenantId}`,
success: (res) => {

},
@@ -186,9 +199,9 @@ Page({
console.log(`showModal调用失败`);
},
});
} else if (this_.data.order.couponOrderStatus == 3) {//退款中
} else if (this_.data.order.couponOrderStatus == 3) { //退款中
tt.navigateTo({
url: `/pages/refund/refund?id=${this.data.order.id}`,
url: `/pages/refund/refund?id=${this.data.order.id}&mallTenantId=${this.data.mallTenantId}`,
success: (res) => {

},
@@ -209,7 +222,8 @@ Page({
Http.get({
url: url,
data: {
orderId: this.data.orderId
orderId: this.data.orderId,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
tt.hideLoading();
@@ -294,7 +308,7 @@ Page({
createDate: createDate,
composeOrderType: tempData.composeOrderType,
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已退款
that.setRq()
@@ -302,29 +316,30 @@ Page({
let setInter = setInterval(() => {
if (tempData.couponOrderStatus == 0) {
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,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
console.log(res);
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 => {
tt.showToast({
title: err.errMsg,
@@ -339,8 +354,8 @@ Page({
setInter: setInter
})
}
if (tempData.couponOrderStatus && tempData.couponOrderStatus == 1) {//核销后
that.goIfEvaluate()//判断订单是否能评价
if (tempData.couponOrderStatus && tempData.couponOrderStatus == 1) { //核销后
that.goIfEvaluate() //判断订单是否能评价
}
}).catch(error => {
console.log(error, "error");
@@ -392,9 +407,9 @@ Page({
let that = this;
// 获取用户信息
Http.get({
url: config.api.getScore,
data: {}
})
url: config.api.getScore,
data: {}
})
.then(res => {
console.log(res)
that.setData({
@@ -440,7 +455,7 @@ Page({
_this.setData({
showhieRq: false,
})
Http.get({//获取动态二维码
Http.get({ //获取动态二维码
url: config.api.dynamicId,
data: {
couponOrderId: _this.data.order.couponOrderId
@@ -541,20 +556,20 @@ Page({
getStaticGame(token) {
let _this = this;
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({
showIf: true
staticGamedata: res.data
})
}
_this.setData({
staticGamedata: res.data
})
})
.catch(err => {
console.log(err);
})
@@ -563,7 +578,9 @@ Page({
let _this = this
tt.rateAwemeOrder({
orderId: _this.data.payOrderNo,
success({ result }) {
success({
result
}) {
console.log(result);
if (result) {
tt.navigateBack({
@@ -596,7 +613,9 @@ Page({
}).then(res => {
tt.canRateAwemeOrders({
orderIds: [res.data.payOrderNo],
success({ result }) {
success({
result
}) {
console.log("result", result);
_this.setData({
evaluateFlag: result[0],
@@ -619,6 +638,13 @@ Page({
*/
onLoad: function (options) {
this.getSeUrl()

if (options.mallTenantId) {
this.setData({
mallTenantId: options.mallTenantId,
})
}

this.setData({
mouldType: app.globalData.mouldType
})
@@ -631,7 +657,7 @@ Page({

});
tt.hideShareMenu()
if (options.cardIf) {//转赠 展示不需
if (options.cardIf) { //转赠 展示不需
that.setData({
cardIf: true
})
@@ -650,7 +676,7 @@ Page({
})
that.updetail()
},
getSeUrl() {//获取客服链接
getSeUrl() { //获取客服链接
const openId = tt.getStorageSync('openId');
Http.post({
url: config.api.getServiceUrl,
@@ -686,13 +712,13 @@ Page({
let that = this;
// 支付成功
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 => {
tt.redirectTo({
url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}`
@@ -719,7 +745,7 @@ Page({
// if (true) {//兼容不支持支付2.0 js-api !tt.canIUse('createOrder')
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
console.log(outOrderNo, "outOrderNo");
Http.post({
@@ -727,7 +753,8 @@ Page({
data: {
// composeOrderId: outOrderNo
orderId: outOrderNo,
composeOrderType: that.data.composeOrderType
composeOrderType: that.data.composeOrderType,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res => {
if (res.data.createPay) {
@@ -742,12 +769,21 @@ Page({
that.setData({
showbutton: false,
})
const { orderId, outOrderNo } = res;
const {
orderId,
outOrderNo
} = res;
// that.setData({ orderId, outOrderNo });
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, '');
},
fail: res => {
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
const {
orderId,
outOrderNo,
errNo,
errMsg,
errLogId
} = res;
if (errLogId) {
tt.hideLoading();
that.setData({
@@ -795,7 +831,13 @@ Page({
that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that); // 支付成功
},
fail: res => {
const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
const {
orderId,
outOrderNo,
errNo,
errMsg,
errLogId
} = res;
if (errLogId) {
console.log('查询订单信息失败', errNo, errMsg, errLogId);
that.setData({
@@ -833,11 +875,11 @@ Page({
icon: "none"
});
})
} else {//不支持支付2.0 js-api
} else { //不支持支付2.0 js-api
tt.showToast({
title: '请升级抖音', // 内容
icon: "none"
});
});
return
// 支付金额不为0
Http.post({
@@ -979,14 +1021,14 @@ Page({
payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => {
// 支付成功
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 => {
tt.hideLoading();
_this.setData({
@@ -1045,5 +1087,4 @@ Page({
clearInterval(that.data.setInter);
clearInterval(that.data.templTiem);
},
});

});

+ 159
- 133
pages/order/index/index.js Целия файл

@@ -6,7 +6,7 @@ let app = getApp();
const imgurl = require("../../../utils/imgurl");
Page({
data: {
showBox: false,//显示授权手机框
showBox: false, //显示授权手机框
navigationBarHeight,
noOrdersUrl: imgurl.noOrders.url,
loadingUrl: imgurl.loading.url,
@@ -15,21 +15,21 @@ Page({
wmgive: imgurl.wmgive.url,
boatFlag: "all",
tabs: [{
key: "all",
name: "全部"
},
{
key: 0,
name: "待付款"
},
{
key: 1,
name: "已完成"
},
{
key: 3,
name: "售后"
}
key: "all",
name: "全部"
},
{
key: 0,
name: "待付款"
},
{
key: 1,
name: "已完成"
},
{
key: 3,
name: "售后"
}
],
list: [],
current: "",
@@ -38,11 +38,14 @@ Page({
allow_load: true,
page: 1,
content: "",
canIUse: tt.canIUse("button.open-type.getPhoneNumber"),//判断小程序是否能用获取手机插件
ifshowtab:null,
canIUse: tt.canIUse("button.open-type.getPhoneNumber"), //判断小程序是否能用获取手机插件
ifshowtab: null,
shopList: [],
index: 0,
mallTenantId: ''
},

setPhone(paramData) {//子组件调用这个方法说明手机号已经授权成功
setPhone(paramData) { //子组件调用这个方法说明手机号已经授权成功
this.setData({
showBox: paramData.detail,
})
@@ -50,8 +53,7 @@ Page({
tt.showToast({
title: '授权成功', // 内容
icon: 'none', // 图标
success: (res) => {
},
success: (res) => {},
fail: (res) => {

},
@@ -74,58 +76,81 @@ Page({
});
},

bindPickerChange(e) {
const index = e.detail.value
const mallTenantId = this.data.shopList[index].tenantId
tt.setStorageSync('mallTenantId', mallTenantId)
tt.setStorageSync('mallIndex', index)
this.setData({
index: index,
mallTenantId: mallTenantId,
allow_load: true
});
console.log(this.data.mallTenantId);
this.getList(this.data.boatFlag, 1);
},

goback: function () {
tt.reLaunch({
url: '/index/index',
})
},
onLoad(e) {

// this.setData({
// current_scroll: e.id
// });
this.setData({
index: tt.getStorageSync('mallIndex') || 0,
})
},
onShow() {
Http.get({
url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
url: '/mall/subMall?isAll=1',
}).then(res => {
this.setData({
shopList: res.data,
mallTenantId: tt.getStorageSync('mallTenantId') || res.data[0].tenantId
});
this.getList(this.data.boatFlag, 1);
Http.get({
url: config.api.checkPhoneStatus,

url: config.api.checkUserStatus,
data: {
token: app.globalData.token
}
}).then(res => {
Http.get({
url: config.api.checkPhoneStatus
}).then(res => {}).catch(err => {
if (app.globalData.ifCongPh == 1) {
app.globalData.skip = 'navigateBack'
tt.navigateTo({
url: `/pages/getPhone/getPhone?skipUrl=1`,
})
} else {
this.setData({
showBox: true
})
}
})
}).catch(err => {
if (app.globalData.ifCongPh==1) {
app.globalData.skip = 'navigateBack'

if (err.code == 11004) { //未授权抖音
app.globalData.type = 'mo'
tt.navigateTo({
url: `/pages/getPhone/getPhone?skipUrl=1`,
})
}else{
this.setData({
showBox:true
})
}
url: '/pages/getuserinfo/getuserinfo',

});
}
})
}).catch(err => {

if (err.code == 11004) {//未授权抖音
app.globalData.type = 'mo'
tt.navigateTo({
url: '/pages/getuserinfo/getuserinfo',

});
}
})


this.setData({
ifshowtab : app.globalData.ifshowtab,
ifshowtab: app.globalData.ifshowtab,
allow_load: true
})
this.getList(this.data.boatFlag, 1);
},
/**
* 砍价中的状态
@@ -136,38 +161,38 @@ Page({
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${e.currentTarget.dataset.id}`
})
},
cancel(e){//取消订单
cancel(e) { //取消订单
tt.showModal({
title: '提示',
content: '您是否要取消该订单',
confirmText: "确定",
success: (res) => {
if(res.confirm){
Http.post({
url:config.api.orderCancel,
data:{
orderId: e.currentTarget.dataset.id
}
}).then(res=>{
this.getList(this.data.boatFlag, 1);
tt.showToast({
title: "取消订单成功!",
icon: 'none',
duration: 2000,
mask: false
});
}).catch(err=>{
tt.showToast({
title: err.message?err.message:err.data,
icon: 'none',
duration: 2000,
mask: false
});
})
if (res.confirm) {
Http.post({
url: config.api.orderCancel,
data: {
orderId: e.currentTarget.dataset.id
}
}).then(res => {
this.getList(this.data.boatFlag, 1);
tt.showToast({
title: "取消订单成功!",
icon: 'none',
duration: 2000,
mask: false
});
}).catch(err => {
tt.showToast({
title: err.message ? err.message : err.data,
icon: 'none',
duration: 2000,
mask: false
});
})

} else if (res.cancel) {
console.log("取消");
}
} else if (res.cancel) {
console.log("取消");
}
},
fail(err) {
console.log(`showModal 调用失败`, err);
@@ -178,11 +203,11 @@ Page({
let level = e.currentTarget.dataset.level
if (level == 0) {
tt.navigateTo({
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&flag='pay'`
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&mallTenantId=${this.data.mallTenantId}&flag='pay'`
})
} else {
tt.navigateTo({
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&dingdan=order&flag='pay'`
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&mallTenantId=${this.data.mallTenantId}&dingdan=order&flag='pay'`
})
}

@@ -211,18 +236,21 @@ Page({
* key==0
* 不发送该字段
*/
const mallTenantId = tt.getStorageSync('mallTenantId')
if (key == 'all') {
var variable = {
pageNum: pageNum,
pageSize: 10,
paymentType: 0
paymentType: 0,
mallTenantId: mallTenantId || that.data.mallTenantId
};
} else {
var variable = {
pageNum: pageNum,
pageSize: 10,
orderStatus: key,
paymentType: 0
paymentType: 0,
mallTenantId: mallTenantId || that.data.mallTenantId
};
}

@@ -231,57 +259,56 @@ Page({
loading: true,
content: '小主,我在玩命加载中...'
})

Http.get({
url: config.api.orderList,
data: variable
}).then(res => {
if (pageNum >= res.data.pages) {
that.setData({
allow_load: false
});
url: config.api.orderList,
data: variable
}).then(res => {
if (pageNum >= res.data.pages) {
that.setData({
allow_load: false
});
setTimeout(function () {
that.setData({
loading: false,
})
}, 1400);
}
setTimeout(function () {
that.setData({
loading: false,
})
}, 1400);
}
setTimeout(function () {
that.setData({
loading: false,
})
}, 1400);
if (pageNum == 1) {
that.setData({
list: []
})
}
var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr, res.data.list);
// 将砍价的状态过滤出来
console.log(tmpArr)
tmpArr.map(item => {
if (pageNum == 1) {
that.setData({
list: []
})
}
var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr, res.data.list);
// 将砍价的状态过滤出来
console.log(tmpArr)
tmpArr.map(item => {

item.orders.map(itemChild => {
itemChild.createDate = util.formatTime(itemChild.createDate, "yyyy-MM-dd hh:mm:ss");
item.orders.map(itemChild => {
itemChild.createDate = util.formatTime(itemChild.createDate, "yyyy-MM-dd hh:mm:ss");
})
})
})

that.setData({
list: tmpArr
})
for (let i = 0; i < that.data.list.length; i++) {
var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dd hh:mm:ss");
/**
* 修改list的endtime
* 渲染到页面
*/
var createDate = 'list[' + i + '].createDate'
that.setData({
[createDate]: createDate1
});
}
})
list: tmpArr
})
for (let i = 0; i < that.data.list.length; i++) {
var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dd hh:mm:ss");
/**
* 修改list的endtime
* 渲染到页面
*/
var createDate = 'list[' + i + '].createDate'
that.setData({
[createDate]: createDate1
});
}
})
.catch(err => {
tt.showModal({
title: '提示',
@@ -289,8 +316,7 @@ Page({
showCancel: false
})
})
}
else {
} else {
that.setData({
loading: true,
content: "——— 再拉裤子就掉了啦 ———"
@@ -302,7 +328,7 @@ Page({
}, 1400)
}
},
handleChange({
handleChange({
detail
}) {
this.setData({
@@ -311,19 +337,19 @@ Page({
},

setBoatFlag(e) {
if (app.globalData.ifCongPh==1) {
let index = e.currentTarget.dataset.index
console.log(index);
this.setData({
boatFlag: index,
pageNum: 1,
allow_load: true,
})
this.getList(index, 1)
if (app.globalData.ifCongPh == 1) {
let index = e.currentTarget.dataset.index
console.log(index);
this.setData({
boatFlag: index,
pageNum: 1,
allow_load: true,
})
this.getList(index, 1)
} else {
this.setData({
showBox: true
})
this.setData({
showBox: true
})
}

},


+ 22
- 6
pages/order/index/index.ttml Целия файл

@@ -3,7 +3,7 @@
<view style="height:{{navigationBarHeight}} "></view> -->
<view class="market">

<view class="boatBoxf" >
<view class="boatBoxf">
<view class="boatBox">
<view class="boatItemBox" tt:for="{{tabs}}" tt:key="index" bindtap="setBoatFlag" data-index="{{item.key}}">
<view class="{{boatFlag==item.key?'boatTitleA':'boatTitle'}}">{{item.name}}</view>
@@ -12,7 +12,18 @@
</view>
</view>

<view style='padding-top:90rpx;'>
<view class="picker" tt:if="{{shopList.length>1}}">
<view class="title">选择广场</view>
<picker mode="selector" bindchange="bindPickerChange" value="{{index}}" range="{{shopList}}" range-key="name"
disabled="{{false}}">
<view class="picker-item">
当前广场:{{shopList[index].name}}
</view>
</picker>
</view>


<view>
<view tt:for='{{list}}' tt:if="{{list.length!=0}}" class='section' tt:key='index'>
<view class='detail_top'>
<view>
@@ -36,8 +47,10 @@
<text class='close' tt:if="{{child.orderStatus==4}}">已退款</text>
<text class='wait' tt:if="{{child.orderStatus==5}}">退款失败</text>
<text class='sucess' tt:if="{{child.orderStatus==11}}">拼团成功</text>
<text class='sucess' tt:if="{{child.orderStatus==1&&child.salePrice==0&&child.type!=50&&child.type!=51}}">免费领取</text>
<text class='sucess' tt:if="{{child.orderStatus==1&&child.salePrice==0&&(child.type==50||child.type==51)}}">积分兑换</text>
<text class='sucess'
tt:if="{{child.orderStatus==1&&child.salePrice==0&&child.type!=50&&child.type!=51}}">免费领取</text>
<text class='sucess'
tt:if="{{child.orderStatus==1&&child.salePrice==0&&(child.type==50||child.type==51)}}">积分兑换</text>
<text class='sucess' tt:if="{{child.orderStatus==1&&child.salePrice!=0}}">付款成功</text>
</view>

@@ -55,7 +68,9 @@
<text>{{child.createDate}}</text>
</view>

<view tt:if="{{child.orderStatus!=0 && child.orderStatus!=7&&child.orderStatus!=5&&child.orderStatus!=6}}" class="btnZf" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" data-shipping="{{child.shippingType}}" bindtap="gotopay">
<view tt:if="{{child.orderStatus!=0 && child.orderStatus!=7&&child.orderStatus!=5&&child.orderStatus!=6}}"
class="btnZf" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}"
data-shipping="{{child.shippingType}}" bindtap="gotopay">
<text>去查看</text>
</view>
<view tt:if="{{child.orderStatus == 6}}" class="btn" data-id="{{child.id}}" bindtap="gotoDiscount">
@@ -66,7 +81,8 @@
<text>取消</text>
</view> -->

<view tt:if="{{child.orderStatus==0 || child.orderStatus==7}}" class="btnZf" data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" bindtap="gotopay">
<view tt:if="{{child.orderStatus==0 || child.orderStatus==7}}" class="btnZf"
data-shippingtype="{{child.shippingType}}" data-id="{{child.composeOrderId}}" bindtap="gotopay">
<text>去支付</text>
</view>
<view tt:if="{{child.orderStatus==5}}" style="background:#999;opacity: .6;" class="btn">


+ 110
- 73
pages/order/index/index.ttss Целия файл

@@ -1,40 +1,47 @@
.boatBox {
width: 100% !important;
height: 96rpx;
display: flex;
justify-content: space-around;
background-color: #fff;
}

.boatBox{
width: 100% !important;
height: 96rpx;
display: flex;
justify-content: space-around;
background-color: #fff;
}
.boatBoxf{
width: 100% !important;
position: fixed;
top: 0;
left: 0;
z-index: 10000;
}
.boatTitle{
font-size: 30rpx;
text-align: center;
height: 80rpx;
line-height: 80rpx;
color: #999;
}
.boatTitleA{
font-size: 32rpx;
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-weight: 500;
color: #d4a971;
}
.boatA{
.boatBoxf {
width: 100% !important;
position: fixed;
top: 0;
left: 0;
z-index: 10000;
}

.boatTitle {
font-size: 30rpx;
text-align: center;
height: 80rpx;
line-height: 80rpx;
color: #999;
}

.boatTitleA {
font-size: 32rpx;
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-weight: 500;
color: #d4a971;
}

.boatA {
/* #fb3e5c */
width: 80rpx;
height: 6rpx;
background-color: #d4a971;
margin: 0 auto;
border-radius: 10rpx;
width: 80rpx;
height: 6rpx;
background-color: #d4a971;
margin: 0 auto;
border-radius: 10rpx;
}

.picker {
margin-top: 100rpx;
}


@@ -44,6 +51,7 @@
background: #F4F5F9;
margin-top: 20rpx;
}

.tabs {
position: fixed;
width: 100% !important;
@@ -61,10 +69,12 @@
width: 30% !important;
display: inline-block;
}
.section{

.section {
background: #FFFFFF;
overflow: hidden;
}

.detail_msg {
position: relative;
width: 92%;
@@ -75,7 +85,8 @@
padding-top: 20rpx;
/* border-bottom: 1rpx solid #eee; */
}
.sendImg{

.sendImg {
position: absolute;
width: 100rpx;
top: 100rpx;
@@ -96,13 +107,15 @@
height: 120rpx;
border-radius: 20rpx;
}
.detail_top{

.detail_top {
width: 100%;
height: 40rpx;
line-height: 40rpx;
font-size: 30rpx;
padding-top: 30rpx;
}

.detail_top view:nth-child(1) {
display: flex;
justify-content: space-between;
@@ -136,20 +149,21 @@
white-space: nowrap;
text-overflow: ellipsis;
}
.discount{

.discount {
position: absolute;
width: 100rpx;
top:86rpx;
right:2rpx;
top: 86rpx;
right: 2rpx;
}

.detail_top .sucess {
display: inline-block;
width: 123rpx !important;
/* overflow: hidden; */
font-family:PingFangSC-Regular;
font-family: PingFangSC-Regular;
font-size: 28rpx;
font-weight:400;
font-weight: 400;
color: #2C8DFF;
letter-spacing: 0;
text-align: right;
@@ -159,12 +173,12 @@
.wait {
display: inline-block;
width: 123rpx !important;
overflow: visible!important;
overflow: visible !important;
font-size: 28rpx;
color: #FD832D;
letter-spacing: 0;
text-align: right;
line-height: 28rpx!important;
line-height: 28rpx !important;
}

.close {
@@ -205,9 +219,11 @@
.info view:nth-child(3) {
margin-top: 16rpx;
}

.info view:nth-child(2) {
margin-top: 16rpx;
}

.payment {
position: relative;
width: 92%;
@@ -253,8 +269,9 @@
float: right;
font-size: 26rpx;
border-radius: 20rpx;
background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%);
background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%);
}

/* .btnZf{
position: absolute;
bottom: 0;
@@ -269,7 +286,7 @@
border-radius: 20rpx;
background:linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%);
} */
.btnZf{
.btnZf {
position: absolute;
bottom: 0;
right: 0;
@@ -281,10 +298,11 @@
float: right;
font-size: 24rpx;
border-radius: 10rpx;
border: 1rpx solid #d4a971;
border: 1rpx solid #d4a971;
/* background:linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%); */
}
.cancel{

.cancel {
position: absolute;
bottom: 0;
right: 120rpx;
@@ -296,9 +314,10 @@
float: right;
font-size: 24rpx;
border-radius: 10rpx;
border: 1rpx solid #d4a971;
border: 1rpx solid #d4a971;
}
.btnGm{

.btnGm {
position: absolute;
bottom: 0;
right: 0;
@@ -317,10 +336,12 @@
font-size: 26rpx;
color: #FFFFFF;
}
.txGm{
font-size: 26rpx!important;
color: #2C8DFF!important;

.txGm {
font-size: 26rpx !important;
color: #2C8DFF !important;
}

.dingdan {
margin-top: 33rpx;
}
@@ -362,20 +383,25 @@
vertical-align: middle;
margin-right: 10rpx;
}
button::after{ border: none; }
.goback{

button::after {
border: none;
}

.goback {
position: fixed;
right: 50rpx;
bottom: 60rpx;
width:100rpx!important;
height:100rpx;
width: 100rpx !important;
height: 100rpx;
z-index: 100;
background:rgba(255,255,255,1);
background: rgba(255, 255, 255, 1);
line-height: 95rpx;
border:1rpx solid rgba(227,227,227,1);
border-radius:50%;
border: 1rpx solid rgba(227, 227, 227, 1);
border-radius: 50%;
}
.goback image{

.goback image {
position: absolute;
width: 60rpx;
left: 0;
@@ -384,15 +410,18 @@ button::after{ border: none; }
bottom: 0;
margin: auto;
}
.itemBox{

.itemBox {
overflow: hidden;
margin: 0 50rpx 20rpx 50rpx;
padding-bottom: 20rpx;
position: relative;
}
.payStatus{

.payStatus {
text-align: right;
}

/* .payStatus .sucess {
display: inline-block;
width: 123rpx !important;
@@ -407,15 +436,16 @@ button::after{ border: none; }
.payStatus .sucess {
display: inline-block;
width: 123rpx !important;
font-family:PingFangSC-Regular;
font-family: PingFangSC-Regular;
font-size: 28rpx;
font-weight:400;
font-weight: 400;
color: #5cbb43;
letter-spacing: 0;
text-align: right;
line-height: 26px;
}
.itemImg{

.itemImg {
float: left;
display: block;
width: 120rpx;
@@ -423,31 +453,36 @@ button::after{ border: none; }
border: 1px solid #f8f8f8;
border-radius: 20rpx;
}

.itemImg image {
display: block;
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
}
.itemContent{

.itemContent {
float: left;
width: 70%;
}
.face{

.face {
font-size: 24rpx;
color: #999;
letter-spacing: 0;
padding-left: 4%;
line-height: 33rpx;
}
.face text{

.face text {
font-size: 24rpx;
color: #333;
letter-spacing: 0;
line-height: 33rpx;

}
.date{

.date {
/* margin-top: 16rpx; */
font-size: 24rpx;
color: #999;
@@ -456,7 +491,8 @@ button::after{ border: none; }
line-height: 26rpx;

}
.yunfe{

.yunfe {
font-size: 24rpx;
color: #999;
letter-spacing: 0;
@@ -464,7 +500,8 @@ button::after{ border: none; }
height: 33rpx;
line-height: 33rpx;
}
.yunfeK{

.yunfeK {
font-size: 24rpx;
color: #999;
letter-spacing: 0;


+ 15
- 13
pages/refund/refund.js Целия файл

@@ -2,33 +2,34 @@ const Http = require("../../utils/HttpBasics");
var config = require("../../config/config.js");
const util = require("../../utils/util.js");
var app = getApp();
const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
Page({
data: {
navigationBarHeight,
id:"",
obj:null
id: "",
obj: null
},
getRefunData(){
getRefunData() {
Http.get({
url:config.api.getRefund,
data:{
orderId:this.data.id
url: config.api.getRefund,
data: {
orderId: this.data.id,
mallTenantId: this.data.mallTenantId || ''
}
}).then(res=>{
}).then(res => {
let temp = res.data
temp.createTime = util.formatTime(temp.createTime, "yyyy-MM-dd hh:mm:ss");
this.setData({
obj:temp
obj: temp
})
}).catch(err=>{
}).catch(err => {
tt.showToast({
title: err.message ? err.message : err.data, // 内容
icon: "none"
});
})
},
copyId(){
copyId() {
let id = this.data.obj.id
tt.setClipboardData({
data: id,
@@ -43,8 +44,9 @@ Page({
onLoad: function (options) {
console.log(options.id);
this.setData({
id:options.id
id: options.id,
mallTenantId: options.mallTenantId,
})
this.getRefunData()
}
})
})

+ 9
- 0
project.config.json Целия файл

@@ -27,6 +27,15 @@
"scene": "990001",
"launchFrom": "scan",
"location": "qr_code"
},
{
"id": 1669632886124,
"name": "商品支付页",
"pathName": "pages/main/index",
"query": "pages/main/index?type=orderAffirm&couponChannelId=756802201412231168&tenantId=1034",
"scene": "990001",
"launchFrom": "scan",
"location": "qr_code"
}
]
}


Зареждане…
Отказ
Запис