fiexd 修改订单对接,运费查询对接

This commit is contained in:
AERWEN\26795 2023-10-13 13:37:48 +08:00
parent 7b8aa82de1
commit cab6ac91e2
10 changed files with 78 additions and 25 deletions

4
app.js
View File

@ -1,8 +1,8 @@
import updateManager from './common/updateManager';
// export const ServerBasePath = 'http://localhost:8888/api/';
export const ServerBasePath = 'http://localhost:8888/api/';
// export const ServerBasePath = 'http://192.168.1.102:8888/api/';
export const ServerBasePath = 'http://shop.api.aerwen.net/api/';
// export const ServerBasePath = 'http://shop.api.aerwen.net/api/';
App({
onLaunch: function () {},

View File

@ -44,9 +44,12 @@ export function genSettleDetail(params) {
const {
userAddressReq,
couponList,
goodsRequestList
goodsRequestList,
totalDeliveryFee
} = params;
console.log(totalDeliveryFee, '参数是什么');
const resp = {
data: {
settleType: 0,
@ -60,7 +63,7 @@ export function genSettleDetail(params) {
totalCouponAmount: '0',
totalSalePrice: '289997',
totalGoodsAmount: '289997',
totalDeliveryFee: '0',
totalDeliveryFee: totalDeliveryFee,
invoiceRequest: null,
skuImages: null,
deliveryFeeList: null,
@ -143,6 +146,12 @@ export function genSettleDetail(params) {
resp.data.totalPayAmount =
totalPrice - totalDiscountPrice - Number(resp.data.totalPromotionAmount);
if (totalDeliveryFee) {
resp.data.totalPayAmount += resp.data.totalDeliveryFee
console.log(typeof (totalDeliveryFee), '类型是什么');
console.log(totalDeliveryFee, '这里呢');
}
list.forEach(item => {
resp.data.totalGoodsCount += item.quantity
});

View File

@ -71,6 +71,7 @@
<view slot="append-body" class="goods-stepper">
<view class="stepper-tip" wx:if="{{goods.shortageStock}}">库存不足</view>
<t-stepper
wx:if="{{goods.price !== 0}}"
classname="stepper-info"
value="{{goods.quantity}}"
min="{{1}}"

View File

@ -39,7 +39,7 @@
<view class="goods_tips" wx:if="{{goods.stockQuantity !== 0 && goods.quantity >= goods.stockQuantity}}">库存不足</view>
</view>
<view class="wr-goods-card__short_content">
<block wx:if="{{goods.stockQuantity !== 0}}">
<block wx:if="{{goods.stockQuantity !== 0 && goods.price !== 0}}">
<view wx:if="{{ pricePrefix }}" class="wr-goods-card__price__prefix price-prefix-class">{{ pricePrefix }}</view>
<slot name="price-prefix" />
<view wx:if="{{ goods.price && !goods.hideKey.price }}" class="wr-goods-card__price">

View File

@ -197,12 +197,12 @@ Page({
});
this.selectSpecsName(selectedSkuValues.length > 0 ? selectedAttrStr : '');
if (skuItem) {
console.log(skuItem[0]?.skuId,'选中的item');
console.log(skuItem[0],'选中的item');
this.setData({
selectedSkuId: skuItem[0]?.skuId,
selectItem: skuItem,
selectSkuSellsPrice: skuItem[0]?.priceInfo[0].price || 0,
selectSkuLinePrice: skuItem[0]?.priceInfo[1].price || 0,
selectSkuSellsPrice: skuItem[0]?.priceInfo[0]?.price || 0,
selectSkuLinePrice: skuItem[0]?.priceInfo[1]?.price || 0,
selectSkuQuantity: skuItem[0]?.quantity
});
} else {
@ -437,7 +437,10 @@ Page({
soldNum,
} = details;
// details.desc = details.desc.replace(/\<img/gi, '<img style="width:100%;height:auto" ');
// details.desc = details.desc.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
// details.desc = details.desc.replace(/<img[^>]*style\s*=\s*(['"])[^'"]*\1[^>]*>/gi, '<img style="max-width:100%;height:auto;" ');
// details.desc = details.desc.replace(/<img[^>]*>/gi, '<img style="max-3999999996width:100%;height:auto;" >');
skuList.forEach((item) => {
skuArray.push({
@ -461,7 +464,7 @@ Page({
isStock: details.spuStockQuantity > 0,
maxSalePrice: maxSalePrice ? parseInt(maxSalePrice) : 0,
maxLinePrice: maxLinePrice ? parseInt(maxLinePrice) : 0,
minSalePrice: minSalePrice ? parseInt(minSalePrice) : 0,
minSalePrice: minSalePrice,
list: promotionArray,
skuArray: skuArray,
primaryImage,

View File

@ -1,5 +1,6 @@
import Toast from 'tdesign-miniprogram/toast/index';
import { fetchSettleDetail } from '../../../services/order/orderConfirm';
import { fetchSettleDetail } from '~/services/order/orderConfirm';
import { getGoodsFreight } from '~/services/order/getGoodsFreight';
import { commitPay, wechatPayOrder } from './pay';
import { getAddressPromise } from '../../usercenter/address/list/util';
@ -71,7 +72,7 @@ Page({
this.handleOptionsParams({ goodsRequestList });
},
// 处理不同情况下跳转到结算页时需要的参数
handleOptionsParams(options, couponList) {
async handleOptionsParams(options, couponList) {
let { goodsRequestList } = this; // 商品列表
let { userAddressReq } = this; // 收货地址
@ -107,6 +108,21 @@ Page({
userAddressReq,
couponList,
};
if(userAddressReq){
// 计算运费接口
console.log(goodsRequestList,'看看看看')
console.log(userAddressReq.customerAddressGuid,'看看看看地址')
let data = {
GoodsRequestList: goodsRequestList,
CustomerAddressGuid: userAddressReq.customerAddressGuid
}
await getGoodsFreight(data).then((res) => {
params.totalDeliveryFee = res.data
console.log(this.data.settleDetailData,'运费');
})
}
console.log(params,'计算参数');
fetchSettleDetail(params).then(
(res) => {
this.setData({
@ -423,10 +439,10 @@ Page({
duration: 2000,
icon: '',
});
setTimeout(() => {
// 提交支付失败 返回购物车
wx.navigateBack();
}, 2000);
// setTimeout(() => {
// // 提交支付失败 返回购物车
// wx.navigateBack();
// }, 2000);
}
},
(err) => {
@ -474,10 +490,10 @@ Page({
duration: 2000,
icon: '',
});
setTimeout(() => {
// 提交支付失败 返回购物车
wx.navigateBack();
}, 2000);
// setTimeout(() => {
// // 提交支付失败 返回购物车
// wx.navigateBack();
// }, 2000);
}
},
);

View File

@ -14,7 +14,7 @@ export const commitPay = (params) => {
userAddressReq: params.userAddressReq, // 地址信息(用户在购物选择更换地址)
currency: params.currency || 'CNY', // 支付货币: 人民币=CNY美元=USD
logisticsType: params.logisticsType || 1, // 配送方式 0=无需配送 1=快递 2=商家 3=同城 4=自提
// orderMark: params.orderMark, // 下单备注
orderMark: params.orderMark, // 下单备注
orderType: params.orderType || 0, // 订单类型 0=普通订单 1=虚拟订单
payType: params.payType || 1, // 支付类型(0=线上、1=线下)
totalAmount: params.totalAmount, // 新增字段"totalAmount"总的支付金额
@ -58,9 +58,9 @@ export const paySuccess = (payOrderInfo) => {
.map((k) => `${k}=${params[k]}`)
.join('&');
// 跳转支付结果页面
wx.redirectTo({
url: `/pages/order/pay-result/index?${paramsStr}`
});
// wx.redirectTo({
// url: `/pages/order/pay-result/index?${paramsStr}`
// });
};
export const payFail = (payOrderInfo, resultMsg) => {

View File

@ -23,6 +23,8 @@
width: 150rpx;
overflow: hidden;
margin-right: 20rpx;
border-radius: 50%;
border: 1px solid #CDCDCD;
}
.shop-left-img {

View File

@ -0,0 +1,22 @@
import {
request
} from '../_utils/request';
/* 提交订单 */
export async function getGoodsFreight(data) {
return new Promise((resolve, reject) => {
request({
url: `GoodsApi/getGoodsFreight`,
method: 'POST',
data: data,
success: function (res) {
resolve(res);
},
fail: function (error) {
reject(error);
}
});
});
}

View File

@ -57,7 +57,7 @@ export function dispatchCommitPay(params) {
// return new Promise((resolve) => {
// resolve('real api');
// });
console.log(params,'提交订单参数');
return new Promise((resolve, reject) => {
request({
url: `WxPay/wxPay`,