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

msb_beta
ch 3 years ago
parent 4c5e4b829f
commit c4fad44718

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-29 17:38:17 * @Date: 2022-03-29 17:38:17
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-18 17:42:52 * @LastEditTime: 2022-04-19 10:55:44
* @Description: file content * @Description: file content
*/ */
import {ToAsyncAwait, MsbRequestTk} from '@/common/utils'; import {ToAsyncAwait, MsbRequestTk} from '@/common/utils';
@ -74,7 +74,8 @@ export const ApiPutCancelOrder = (data) =>
* @param {*} data * @param {*} data
*/ */
export const ApiPostWxPay = (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": { "globalStyle": {
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle" : "black", "navigationBarTextStyle" : "black",

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

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

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

Loading…
Cancel
Save