修改下单接口,秒杀下单兼容

msb_beta
ch 3 years ago
parent 4c5e4b829f
commit c4fad44718

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-29 17:38:17
* @LastEditors: ch
* @LastEditTime: 2022-04-18 17:42:52
* @LastEditTime: 2022-04-19 10:55:44
* @Description: file content
*/
import {ToAsyncAwait, MsbRequestTk} from '@/common/utils';
@ -74,7 +74,8 @@ export const ApiPutCancelOrder = (data) =>
* @param {*} data
*/
export const ApiPostWxPay = (data) =>
ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/pay/wxPay/app`, data));
// ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/pay/wxPay/app`, data));
ToAsyncAwait(MsbRequestTk.post(`${BASE_URL}/pay/payTest`, data));

@ -266,6 +266,12 @@
}
]
},
"style": {
"app-plus": {
"animationType": "slide-in-right",
"animationDuration": 300
}
},
"globalStyle": {
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle" : "black",

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-24 11:30:55
* @LastEditors: ch
* @LastEditTime: 2022-04-11 10:37:46
* @LastEditTime: 2022-04-19 10:51:46
* @Description: file content
-->
<template>
@ -76,6 +76,11 @@ export default {
skuInfo : {
type : Array,
default : []
},
//
activityStatus : {
type : String,
default : 'noActivity'
}
},
data() {
@ -201,13 +206,13 @@ export default {
* 立即购买
*/
buyNow(){
console.log(this.curSku)
this.$Router.push({
path : '/orderSubmit',
query: {
mode : 'buyNow',
skuId : this.curSku.skuId,
num : this.curBuyNum
num : this.curBuyNum,
activityType : this.activityStatus === 'startActivity' ? 2 : 1
}
})
},

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-23 17:27:21
* @LastEditors: ch
* @LastEditTime: 2022-04-13 11:33:46
* @LastEditTime: 2022-04-19 10:48:00
* @Description: file content
-->
<template>
@ -24,7 +24,7 @@
<Service></Service>
<u-cell label="选择" :value="curSku.name" :border="false" isLink @click="onShowSkuPopup(1)"></u-cell>
<SkuPopup v-model="curSku" :visible.sync="showSkuPopup" :mode="skuMode"
:goodsInfo="goods" :skuInfo="skuInfoData">
:goodsInfo="goods" :skuInfo="skuInfoData" :activityStatus="activityStatus">
</SkuPopup>
</view>
<view class="goods-desc">
@ -36,10 +36,9 @@
<view class="icon cart" @click="$Router.push('/cart')"></view>
</view>
<view class="footer--btns">
<UiButton class="btn" @click="onShowSkuPopup(2)"></UiButton>
<UiButton class="btn btn--buy" @click="onShowSkuPopup(3)">
{{(!productActivityVO.isStartActivity && productActivityVO.isActivity) ? '原价购买' : '立即购买'}}
</UiButton>
<UiButton class="btn" v-if="activityStatus !== 'startActivity' " @click="onShowSkuPopup(2)"></UiButton>
<UiButton class="btn btn--buy" v-if="activityStatus === 'noStartActivity'" @click="onShowSkuPopup(3)"></UiButton>
<UiButton class="btn btn--buy" v-else @click="onShowSkuPopup(3)"> </UiButton>
</view>
</view>
</view>
@ -72,6 +71,19 @@ export default {
productActivityVO : {}
}
},
computed:{
activityStatus(){
// noActivity noStartActivity startActivity
let status = 'noActivity';
if(this.productActivityVO.isActivity){
status = 'noStartActivity';
}
if(this.productActivityVO.isStartActivity){
status = 'startActivity';
}
return status;
}
},
onLoad(){
this.getGoodsDetail();
},

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-20 14:14:53
* @LastEditors: ch
* @LastEditTime: 2022-04-18 18:33:51
* @LastEditTime: 2022-04-19 10:58:00
* @Description: file content
-->
<template>
@ -108,7 +108,9 @@ export default {
if(query.mode === 'buyNow'){
res = await ApiGetBeforeOrder({
productSkuId : query.skuId,
quantity : query.num
quantity : query.num,
// 1 2
activityType : query.activityType
});
}
if(res.error){
@ -123,13 +125,15 @@ export default {
* 提交订单
*/
async submit(){
const {query} = this.$Route;
const {error, result} = await ApiPostSubmitOrder({
orderSource : 2,
recipientAddressId : this.address.id,
products : this.orderInfo.products.map(i => ({
productId : i.productId,
productSkuId : i.productSkuId,
quantity : i.quantity
quantity : i.quantity,
activityType : query.activityType
})),
userMessage : this.userMessage
});
@ -140,11 +144,11 @@ export default {
this.wxpay(result.orderId);
},
async wxpay(orderId){
const {error, result} = await ApiPostWxPay({orderId});
const {error, result} = await ApiPostWxPay({orderId,payTypeEnum:'WXPAY'});
if(error){
this.$Router.push(`/payFail?ordId=${orderId}`)
this.$Router.replace(`/payFail?ordId=${orderId}`)
}else{
this.$Router.push(`/paySuccess?ordId=${orderId}`)
this.$Router.replace(`/paySuccess?ordId=${orderId}`)
}
}

Loading…
Cancel
Save