fiexd 修改订单对接,运费查询对接
This commit is contained in:
parent
7b8aa82de1
commit
cab6ac91e2
4
app.js
4
app.js
@ -1,8 +1,8 @@
|
|||||||
import updateManager from './common/updateManager';
|
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://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({
|
App({
|
||||||
onLaunch: function () {},
|
onLaunch: function () {},
|
||||||
|
@ -44,9 +44,12 @@ export function genSettleDetail(params) {
|
|||||||
const {
|
const {
|
||||||
userAddressReq,
|
userAddressReq,
|
||||||
couponList,
|
couponList,
|
||||||
goodsRequestList
|
goodsRequestList,
|
||||||
|
totalDeliveryFee
|
||||||
} = params;
|
} = params;
|
||||||
|
|
||||||
|
console.log(totalDeliveryFee, '参数是什么');
|
||||||
|
|
||||||
const resp = {
|
const resp = {
|
||||||
data: {
|
data: {
|
||||||
settleType: 0,
|
settleType: 0,
|
||||||
@ -60,7 +63,7 @@ export function genSettleDetail(params) {
|
|||||||
totalCouponAmount: '0',
|
totalCouponAmount: '0',
|
||||||
totalSalePrice: '289997',
|
totalSalePrice: '289997',
|
||||||
totalGoodsAmount: '289997',
|
totalGoodsAmount: '289997',
|
||||||
totalDeliveryFee: '0',
|
totalDeliveryFee: totalDeliveryFee,
|
||||||
invoiceRequest: null,
|
invoiceRequest: null,
|
||||||
skuImages: null,
|
skuImages: null,
|
||||||
deliveryFeeList: null,
|
deliveryFeeList: null,
|
||||||
@ -143,6 +146,12 @@ export function genSettleDetail(params) {
|
|||||||
resp.data.totalPayAmount =
|
resp.data.totalPayAmount =
|
||||||
totalPrice - totalDiscountPrice - Number(resp.data.totalPromotionAmount);
|
totalPrice - totalDiscountPrice - Number(resp.data.totalPromotionAmount);
|
||||||
|
|
||||||
|
if (totalDeliveryFee) {
|
||||||
|
resp.data.totalPayAmount += resp.data.totalDeliveryFee
|
||||||
|
console.log(typeof (totalDeliveryFee), '类型是什么');
|
||||||
|
console.log(totalDeliveryFee, '这里呢');
|
||||||
|
}
|
||||||
|
|
||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
resp.data.totalGoodsCount += item.quantity
|
resp.data.totalGoodsCount += item.quantity
|
||||||
});
|
});
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
<view slot="append-body" class="goods-stepper">
|
<view slot="append-body" class="goods-stepper">
|
||||||
<view class="stepper-tip" wx:if="{{goods.shortageStock}}">库存不足</view>
|
<view class="stepper-tip" wx:if="{{goods.shortageStock}}">库存不足</view>
|
||||||
<t-stepper
|
<t-stepper
|
||||||
|
wx:if="{{goods.price !== 0}}"
|
||||||
classname="stepper-info"
|
classname="stepper-info"
|
||||||
value="{{goods.quantity}}"
|
value="{{goods.quantity}}"
|
||||||
min="{{1}}"
|
min="{{1}}"
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<view class="goods_tips" wx:if="{{goods.stockQuantity !== 0 && goods.quantity >= goods.stockQuantity}}">库存不足</view>
|
<view class="goods_tips" wx:if="{{goods.stockQuantity !== 0 && goods.quantity >= goods.stockQuantity}}">库存不足</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wr-goods-card__short_content">
|
<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>
|
<view wx:if="{{ pricePrefix }}" class="wr-goods-card__price__prefix price-prefix-class">{{ pricePrefix }}</view>
|
||||||
<slot name="price-prefix" />
|
<slot name="price-prefix" />
|
||||||
<view wx:if="{{ goods.price && !goods.hideKey.price }}" class="wr-goods-card__price">
|
<view wx:if="{{ goods.price && !goods.hideKey.price }}" class="wr-goods-card__price">
|
||||||
|
@ -197,12 +197,12 @@ Page({
|
|||||||
});
|
});
|
||||||
this.selectSpecsName(selectedSkuValues.length > 0 ? selectedAttrStr : '');
|
this.selectSpecsName(selectedSkuValues.length > 0 ? selectedAttrStr : '');
|
||||||
if (skuItem) {
|
if (skuItem) {
|
||||||
console.log(skuItem[0]?.skuId,'选中的item');
|
console.log(skuItem[0],'选中的item');
|
||||||
this.setData({
|
this.setData({
|
||||||
selectedSkuId: skuItem[0]?.skuId,
|
selectedSkuId: skuItem[0]?.skuId,
|
||||||
selectItem: skuItem,
|
selectItem: skuItem,
|
||||||
selectSkuSellsPrice: skuItem[0]?.priceInfo[0].price || 0,
|
selectSkuSellsPrice: skuItem[0]?.priceInfo[0]?.price || 0,
|
||||||
selectSkuLinePrice: skuItem[0]?.priceInfo[1].price || 0,
|
selectSkuLinePrice: skuItem[0]?.priceInfo[1]?.price || 0,
|
||||||
selectSkuQuantity: skuItem[0]?.quantity
|
selectSkuQuantity: skuItem[0]?.quantity
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -437,7 +437,10 @@ Page({
|
|||||||
soldNum,
|
soldNum,
|
||||||
} = details;
|
} = 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) => {
|
skuList.forEach((item) => {
|
||||||
skuArray.push({
|
skuArray.push({
|
||||||
@ -461,7 +464,7 @@ Page({
|
|||||||
isStock: details.spuStockQuantity > 0,
|
isStock: details.spuStockQuantity > 0,
|
||||||
maxSalePrice: maxSalePrice ? parseInt(maxSalePrice) : 0,
|
maxSalePrice: maxSalePrice ? parseInt(maxSalePrice) : 0,
|
||||||
maxLinePrice: maxLinePrice ? parseInt(maxLinePrice) : 0,
|
maxLinePrice: maxLinePrice ? parseInt(maxLinePrice) : 0,
|
||||||
minSalePrice: minSalePrice ? parseInt(minSalePrice) : 0,
|
minSalePrice: minSalePrice,
|
||||||
list: promotionArray,
|
list: promotionArray,
|
||||||
skuArray: skuArray,
|
skuArray: skuArray,
|
||||||
primaryImage,
|
primaryImage,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import Toast from 'tdesign-miniprogram/toast/index';
|
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 { commitPay, wechatPayOrder } from './pay';
|
||||||
import { getAddressPromise } from '../../usercenter/address/list/util';
|
import { getAddressPromise } from '../../usercenter/address/list/util';
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ Page({
|
|||||||
this.handleOptionsParams({ goodsRequestList });
|
this.handleOptionsParams({ goodsRequestList });
|
||||||
},
|
},
|
||||||
// 处理不同情况下跳转到结算页时需要的参数
|
// 处理不同情况下跳转到结算页时需要的参数
|
||||||
handleOptionsParams(options, couponList) {
|
async handleOptionsParams(options, couponList) {
|
||||||
let { goodsRequestList } = this; // 商品列表
|
let { goodsRequestList } = this; // 商品列表
|
||||||
let { userAddressReq } = this; // 收货地址
|
let { userAddressReq } = this; // 收货地址
|
||||||
|
|
||||||
@ -107,6 +108,21 @@ Page({
|
|||||||
userAddressReq,
|
userAddressReq,
|
||||||
couponList,
|
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(
|
fetchSettleDetail(params).then(
|
||||||
(res) => {
|
(res) => {
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -423,10 +439,10 @@ Page({
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
icon: '',
|
icon: '',
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
// 提交支付失败 返回购物车
|
// // 提交支付失败 返回购物车
|
||||||
wx.navigateBack();
|
// wx.navigateBack();
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
@ -474,10 +490,10 @@ Page({
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
icon: '',
|
icon: '',
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
// 提交支付失败 返回购物车
|
// // 提交支付失败 返回购物车
|
||||||
wx.navigateBack();
|
// wx.navigateBack();
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -14,7 +14,7 @@ export const commitPay = (params) => {
|
|||||||
userAddressReq: params.userAddressReq, // 地址信息(用户在购物选择更换地址)
|
userAddressReq: params.userAddressReq, // 地址信息(用户在购物选择更换地址)
|
||||||
currency: params.currency || 'CNY', // 支付货币: 人民币=CNY,美元=USD
|
currency: params.currency || 'CNY', // 支付货币: 人民币=CNY,美元=USD
|
||||||
logisticsType: params.logisticsType || 1, // 配送方式 0=无需配送 1=快递 2=商家 3=同城 4=自提
|
logisticsType: params.logisticsType || 1, // 配送方式 0=无需配送 1=快递 2=商家 3=同城 4=自提
|
||||||
// orderMark: params.orderMark, // 下单备注
|
orderMark: params.orderMark, // 下单备注
|
||||||
orderType: params.orderType || 0, // 订单类型 0=普通订单 1=虚拟订单
|
orderType: params.orderType || 0, // 订单类型 0=普通订单 1=虚拟订单
|
||||||
payType: params.payType || 1, // 支付类型(0=线上、1=线下)
|
payType: params.payType || 1, // 支付类型(0=线上、1=线下)
|
||||||
totalAmount: params.totalAmount, // 新增字段"totalAmount"总的支付金额
|
totalAmount: params.totalAmount, // 新增字段"totalAmount"总的支付金额
|
||||||
@ -58,9 +58,9 @@ export const paySuccess = (payOrderInfo) => {
|
|||||||
.map((k) => `${k}=${params[k]}`)
|
.map((k) => `${k}=${params[k]}`)
|
||||||
.join('&');
|
.join('&');
|
||||||
// 跳转支付结果页面
|
// 跳转支付结果页面
|
||||||
wx.redirectTo({
|
// wx.redirectTo({
|
||||||
url: `/pages/order/pay-result/index?${paramsStr}`
|
// url: `/pages/order/pay-result/index?${paramsStr}`
|
||||||
});
|
// });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const payFail = (payOrderInfo, resultMsg) => {
|
export const payFail = (payOrderInfo, resultMsg) => {
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid #CDCDCD;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop-left-img {
|
.shop-left-img {
|
||||||
|
22
services/order/getGoodsFreight.js
Normal file
22
services/order/getGoodsFreight.js
Normal 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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -57,7 +57,7 @@ export function dispatchCommitPay(params) {
|
|||||||
// return new Promise((resolve) => {
|
// return new Promise((resolve) => {
|
||||||
// resolve('real api');
|
// resolve('real api');
|
||||||
// });
|
// });
|
||||||
|
console.log(params,'提交订单参数');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request({
|
request({
|
||||||
url: `WxPay/wxPay`,
|
url: `WxPay/wxPay`,
|
||||||
|
Loading…
Reference in New Issue
Block a user