mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-05 00:49:49 +08:00
升级自定义交易组件常用商品接口,spu接口,品牌接口,订单接口,物流接口。
This commit is contained in:
@@ -74,7 +74,9 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getPayments()
|
||||
this.getPayments();
|
||||
console.log('类型:' + this.type);
|
||||
console.log('订单号:' + this.orderId);
|
||||
},
|
||||
methods: {
|
||||
// 获取可用支付方式列表
|
||||
@@ -128,16 +130,16 @@
|
||||
switch (code) {
|
||||
case 'wechatpay':
|
||||
this.$u.api.pay(data).then(res => {
|
||||
console.log(res);
|
||||
if (res.status) {
|
||||
if (res.otherData.checkSceneResult) {
|
||||
if (res.data.checkBeforeAddOrder && res.data.checkBeforeAddOrder.requireOrder == 1) {
|
||||
console.log("自定义交易组件");
|
||||
wx.requestOrderPayment({
|
||||
timeStamp: res.data.timeStamp,
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.package,
|
||||
signType: res.data.signType,
|
||||
paySign: res.data.paySign,
|
||||
orderInfo: res.otherData.orderInfo,
|
||||
timeStamp: res.data.paymentParameters.timeStamp + '',
|
||||
nonceStr: res.data.paymentParameters.nonceStr,
|
||||
package: res.data.paymentParameters.package,
|
||||
signType: res.data.paymentParameters.signType,
|
||||
paySign: res.data.paymentParameters.paySign,
|
||||
success: function (e) {
|
||||
console.log(e);
|
||||
if (e.errMsg === 'requestOrderPayment:ok') {
|
||||
@@ -153,6 +155,7 @@
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("普通订单");
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.timeStamp,
|
||||
|
||||
@@ -337,12 +337,38 @@
|
||||
isOpenMailing: true,
|
||||
isOpenSelfDelivery: true,
|
||||
OrderDistributionModels: [],
|
||||
OrderDistributionModelCurrent: ''
|
||||
OrderDistributionModelCurrent: '',
|
||||
requireOrder: 0,//自定义交易组件是否需要推单,1:需要,0:不需要
|
||||
requiredFundType: 0, //requireOrder = 1时生效,0,非二级商户号订单,1,二级商户号订单,2,两种方式皆可(后续只会存在1)
|
||||
traceId: '', //跟踪ID,有效期十分钟,会影响主播归因、分享员归因等,需创建订单前调用,调用生成订单 api 时需传入该参数
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
onLoad(options) {
|
||||
console.log(options);
|
||||
var _this = this;
|
||||
//下单前置检查,自定义交易组件检测场景是否需要推送订单到微信服务。
|
||||
wx.checkBeforeAddOrder({
|
||||
success(res) {
|
||||
console.log('下单前置检查', res);
|
||||
if (res.errMsg == 'checkBeforeAddOrder:ok') {
|
||||
_this.requireOrder = res.data.requireOrder;
|
||||
_this.requiredFundType = res.data.requiredFundType;
|
||||
_this.traceId = res.data.traceId;
|
||||
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
_this.getOrderDistributionModel()
|
||||
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
//微信说一般不会报错,所以我相信马化腾。
|
||||
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
_this.getOrderDistributionModel()
|
||||
}
|
||||
})
|
||||
|
||||
let cartIds = options.cartIds;
|
||||
if (options.orderType) {
|
||||
this.orderType = options.orderType;
|
||||
@@ -365,8 +391,7 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
this.getOrderDistributionModel()
|
||||
|
||||
// 获取用户的默认收货地址信息
|
||||
this.userDefaultShip()
|
||||
// 获取用户的可用优惠券信息
|
||||
@@ -441,36 +466,45 @@
|
||||
},
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
getOrderDistributionModel() {
|
||||
let data = {
|
||||
id: this.orderType
|
||||
};
|
||||
this.$u.api.getOrderDistributionModel(data).then(res => {
|
||||
if (res.status) {
|
||||
//物流快递
|
||||
this.isOpenMailing = res.data.isOpenMailing;
|
||||
//同城配送
|
||||
this.isOpenHomeDelivery = res.data.isOpenHomeDelivery;
|
||||
//上门自提
|
||||
this.isOpenSelfDelivery = res.data.isOpenSelfDelivery;
|
||||
if (this.requireOrder == 1) {
|
||||
let newTypeItems = [];
|
||||
newTypeItems.push('快递物流');
|
||||
this.OrderDistributionModels.push('isOpenMailing');
|
||||
this.typeItems = newTypeItems;
|
||||
this.OrderDistributionModelCurrent = this.OrderDistributionModels[0];
|
||||
} else {
|
||||
let data = {
|
||||
id: this.orderType
|
||||
};
|
||||
this.$u.api.getOrderDistributionModel(data).then(res => {
|
||||
if (res.status) {
|
||||
//物流快递
|
||||
this.isOpenMailing = res.data.isOpenMailing;
|
||||
//同城配送
|
||||
this.isOpenHomeDelivery = res.data.isOpenHomeDelivery;
|
||||
//上门自提
|
||||
this.isOpenSelfDelivery = res.data.isOpenSelfDelivery;
|
||||
|
||||
let newTypeItems = [];
|
||||
if (this.isOpenMailing) {
|
||||
newTypeItems.push('快递物流');
|
||||
this.OrderDistributionModels.push('isOpenMailing');
|
||||
if (this.requireOrder == 0) {
|
||||
let newTypeItems = [];
|
||||
if (this.isOpenMailing) {
|
||||
newTypeItems.push('快递物流');
|
||||
this.OrderDistributionModels.push('isOpenMailing');
|
||||
}
|
||||
if (this.isOpenHomeDelivery) {
|
||||
newTypeItems.push('同城配送');
|
||||
this.OrderDistributionModels.push('isOpenHomeDelivery');
|
||||
}
|
||||
if (this.isOpenSelfDelivery) {
|
||||
newTypeItems.push('门店自提');
|
||||
this.OrderDistributionModels.push('isOpenSelfDelivery');
|
||||
}
|
||||
this.typeItems = newTypeItems;
|
||||
}
|
||||
this.OrderDistributionModelCurrent = this.OrderDistributionModels[0];
|
||||
}
|
||||
if (this.isOpenHomeDelivery) {
|
||||
newTypeItems.push('同城配送');
|
||||
this.OrderDistributionModels.push('isOpenHomeDelivery');
|
||||
}
|
||||
if (this.isOpenSelfDelivery) {
|
||||
newTypeItems.push('门店自提');
|
||||
this.OrderDistributionModels.push('isOpenSelfDelivery');
|
||||
}
|
||||
this.typeItems = newTypeItems;
|
||||
this.OrderDistributionModelCurrent = this.OrderDistributionModels[0];
|
||||
}
|
||||
console.log(res);
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// 获取用户的默认收货地址
|
||||
userDefaultShip() {
|
||||
@@ -680,7 +714,10 @@
|
||||
objectId: this.objectId,
|
||||
teamId: this.teamId,
|
||||
orderType: this.orderType, //订单类型
|
||||
scene: this.$store.state.scene //场景值(用于确定小程序是否来源直播和视频号)
|
||||
scene: this.$store.state.scene, //场景值(用于确定小程序是否来源直播和视频号)
|
||||
requireOrder: this.requireOrder,
|
||||
requiredFundType: this.requiredFundType,
|
||||
traceId: this.traceId,
|
||||
}
|
||||
|
||||
let delivery = {}
|
||||
|
||||
Reference in New Issue
Block a user