feat 添加订单确认页面区分店铺
This commit is contained in:
parent
ad4f22e60c
commit
f0e2b7ecfc
@ -2,6 +2,9 @@ import {
|
||||
mockIp,
|
||||
mockReqId
|
||||
} from '../../utils/mock';
|
||||
import {
|
||||
getGoodsFreight
|
||||
} from '~/services/order/getGoodsFreight';
|
||||
|
||||
export const transformGoodsDataToConfirmData = (goodsDataList) => {
|
||||
const list = [];
|
||||
@ -40,10 +43,11 @@ export const transformGoodsDataToConfirmData = (goodsDataList) => {
|
||||
};
|
||||
|
||||
/** 生成结算数据 */
|
||||
export function genSettleDetail(params) {
|
||||
export async function genSettleDetail(params) {
|
||||
const {
|
||||
userAddressReq,
|
||||
couponList,
|
||||
storeInfoList,
|
||||
goodsRequestList,
|
||||
totalDeliveryFee
|
||||
} = params;
|
||||
@ -67,23 +71,25 @@ export function genSettleDetail(params) {
|
||||
invoiceRequest: null,
|
||||
skuImages: null,
|
||||
deliveryFeeList: null,
|
||||
storeGoodsList: [{
|
||||
storeId: '1000',
|
||||
storeName: '云Mall深圳旗舰店',
|
||||
remark: null,
|
||||
goodsCount: 1,
|
||||
deliveryFee: '0',
|
||||
deliveryWords: null,
|
||||
storeTotalAmount: '0',
|
||||
storeTotalPayAmount: '179997',
|
||||
storeTotalDiscountAmount: '110000',
|
||||
storeTotalCouponAmount: '0',
|
||||
skuDetailVos: [],
|
||||
couponList: [{
|
||||
couponId: 11,
|
||||
storeId: '1000',
|
||||
}, ],
|
||||
}, ],
|
||||
storeGoodsList: [
|
||||
// {
|
||||
// storeId: '1000',
|
||||
// storeName: '云Mall深圳旗舰店',
|
||||
// remark: null,
|
||||
// goodsCount: 1,
|
||||
// deliveryFee: '0',
|
||||
// deliveryWords: null,
|
||||
// storeTotalAmount: '0',
|
||||
// storeTotalPayAmount: '179997',
|
||||
// storeTotalDiscountAmount: '110000',
|
||||
// storeTotalCouponAmount: '0',
|
||||
// skuDetailVos: [],
|
||||
// couponList: [{
|
||||
// couponId: 11,
|
||||
// storeId: '1000',
|
||||
// }, ],
|
||||
// },
|
||||
],
|
||||
inValidGoodsList: null,
|
||||
outOfStockGoodsList: null,
|
||||
limitGoodsList: null,
|
||||
@ -98,10 +104,63 @@ export function genSettleDetail(params) {
|
||||
success: true,
|
||||
};
|
||||
|
||||
console.log(storeInfoList, '测试前端用店铺判断');
|
||||
|
||||
const storeGoodsList = []
|
||||
// 将商品塞进对应的店铺
|
||||
storeInfoList.forEach((store) => {
|
||||
const storeGoods = {
|
||||
storeId: "",
|
||||
storeName: "",
|
||||
goodsCount: 0,
|
||||
deliveryFee: 0,
|
||||
storeTotalAmount: 0,
|
||||
storeTotalDiscountAmount: 0,
|
||||
storeTotalCouponAmount: 0,
|
||||
couponList: [{
|
||||
couponId: 11,
|
||||
storeId: '1000',
|
||||
}, ],
|
||||
}
|
||||
const storeGoodsRequestList = []
|
||||
storeGoods.storeId = store.storeId
|
||||
storeGoods.storeName = store.storeName
|
||||
|
||||
goodsRequestList.forEach(item => {
|
||||
if (item.storeId === store.storeId) {
|
||||
storeGoods.goodsCount += item.quantity
|
||||
storeGoods.storeTotalAmount += item.quantity * item.price
|
||||
storeGoodsRequestList.push(item)
|
||||
}
|
||||
});
|
||||
|
||||
if (userAddressReq) {
|
||||
let data = {
|
||||
GoodsRequestList: storeGoodsRequestList,
|
||||
CustomerAddressGuid: userAddressReq.customerAddressGuid
|
||||
}
|
||||
getGoodsFreight(data).then((res) => {
|
||||
if (res.code === 0) {
|
||||
resp.data.abnormalDeliveryGoodsList = storeGoodsRequestList
|
||||
}
|
||||
storeGoods.deliveryFee = res.data
|
||||
storeGoods.storeTotalAmount += res.data
|
||||
console.log(storeGoods.deliveryFee, '运费');
|
||||
})
|
||||
}
|
||||
|
||||
const list = transformGoodsDataToConfirmData(storeGoodsRequestList);
|
||||
storeGoods.skuDetailVos = list
|
||||
storeGoodsList.push(storeGoods)
|
||||
})
|
||||
console.log(storeGoodsList, '看看成果');
|
||||
|
||||
const list = transformGoodsDataToConfirmData(goodsRequestList);
|
||||
console.log(list, '看看list');
|
||||
// 获取购物车传递的商品数据
|
||||
resp.data.storeGoodsList[0].skuDetailVos = list;
|
||||
// resp.data.storeGoodsList[0].skuDetailVos = list;
|
||||
// resp.data.storeGoodsList[1].skuDetailVos = list;
|
||||
resp.data.storeGoodsList = storeGoodsList;
|
||||
|
||||
// 判断是否携带优惠券数据
|
||||
const discountPrice = [];
|
||||
|
@ -128,8 +128,6 @@ Page({
|
||||
|
||||
if (userAddressReq) {
|
||||
// 计算运费接口
|
||||
console.log(goodsRequestList, '看看看看')
|
||||
console.log(userAddressReq.customerAddressGuid, '看看看看地址')
|
||||
let data = {
|
||||
GoodsRequestList: goodsRequestList,
|
||||
CustomerAddressGuid: userAddressReq.customerAddressGuid
|
||||
@ -147,7 +145,8 @@ Page({
|
||||
});
|
||||
this.initData(res.data);
|
||||
},
|
||||
() => {
|
||||
(e) => {
|
||||
console.log(e,'异常');
|
||||
//接口异常处理
|
||||
this.handleError();
|
||||
},
|
||||
@ -157,6 +156,7 @@ Page({
|
||||
// 转换商品卡片显示数据
|
||||
const data = this.handleResToGoodsCard(resData);
|
||||
this.userAddressReq = resData.userAddress;
|
||||
console.log(data,'看看data');
|
||||
|
||||
if (resData.userAddress) {
|
||||
this.setData({
|
||||
@ -336,9 +336,7 @@ Page({
|
||||
});
|
||||
},
|
||||
onNotes(e) {
|
||||
const {
|
||||
storenoteindex: storeNoteIndex
|
||||
} = e.currentTarget.dataset;
|
||||
const storeNoteIndex = e.currentTarget.dataset.storenoteindex;
|
||||
// 添加备注信息
|
||||
this.setData({
|
||||
dialogShow: true,
|
||||
|
@ -4,25 +4,13 @@
|
||||
<wxs module="getNotes" src="./getNotes.wxs" />
|
||||
<view class="order-sure" wx:if="{{!loading}}">
|
||||
<address-card addressData="{{userAddress}}" bind:addclick="onGotoAddress" bind:addressclick="onGotoAddress" />
|
||||
<view
|
||||
class="order-wrapper"
|
||||
wx:for="{{settleDetailData.storeGoodsList}}"
|
||||
wx:for-item="stores"
|
||||
wx:for-index="storeIndex"
|
||||
wx:key="storeIndex"
|
||||
>
|
||||
<!-- <view class="store-wrapper">
|
||||
|
||||
<view class="order-wrapper" wx:for="{{settleDetailData.storeGoodsList}}" wx:for-item="stores" wx:for-index="storeIndex" wx:key="storeIndex">
|
||||
<view class="store-wrapper">
|
||||
<t-icon prefix="wr" size="40rpx" color="#333333" name="store" class="store-logo" />
|
||||
{{stores.storeName}}
|
||||
</view> -->
|
||||
<view
|
||||
wx:if="{{orderCardList[storeIndex].goodsList.length > 0}}"
|
||||
wx:for="{{orderCardList[storeIndex].goodsList}}"
|
||||
wx:for-item="goods"
|
||||
wx:for-index="gIndex"
|
||||
wx:key="id"
|
||||
class="goods-wrapper"
|
||||
>
|
||||
</view>
|
||||
<view wx:if="{{orderCardList[storeIndex].goodsList.length > 0}}" wx:for="{{orderCardList[storeIndex].goodsList}}" wx:for-item="goods" wx:for-index="gIndex" wx:key="id" class="goods-wrapper">
|
||||
<image src="{{goods.thumb}}" class="goods-image" mode="aspectFill" />
|
||||
<view class="goods-content">
|
||||
<view class="goods-title">{{goods.title}}</view>
|
||||
@ -33,76 +21,75 @@
|
||||
<view class="goods-num">x{{goods.num}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pay-detail">
|
||||
<view class="pay-item">
|
||||
<text>商品总额</text>
|
||||
<price
|
||||
priceUnit="yuan"
|
||||
fill
|
||||
decimalSmaller
|
||||
wr-class="pay-item__right font-bold"
|
||||
price="{{settleDetailData.totalSalePrice || '0'}}"
|
||||
/>
|
||||
</view>
|
||||
<view class="pay-item">
|
||||
<text>运费</text>
|
||||
<view class="pay-item__right font-bold">
|
||||
<block wx:if="{{settleDetailData.totalDeliveryFee && settleDetailData.totalDeliveryFee != 0}}">
|
||||
+
|
||||
<price priceUnit="yuan" fill decimalSmaller price="{{settleDetailData.totalDeliveryFee}}" />
|
||||
</block>
|
||||
<text wx:else>免运费</text>
|
||||
|
||||
<view class="pay-detail">
|
||||
<view class="pay-item">
|
||||
<text>商品总额</text>
|
||||
<!-- <price priceUnit="yuan" fill decimalSmaller wr-class="pay-item__right font-bold" price="{{settleDetailData.totalSalePrice || '0'}}" /> -->
|
||||
<price priceUnit="yuan" fill decimalSmaller wr-class="pay-item__right font-bold" price="{{stores.storeTotalAmount || '0'}}" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="pay-item">
|
||||
<text>活动优惠</text>
|
||||
<view class="pay-item__right primary font-bold">
|
||||
-
|
||||
<price priceUnit="yuan" fill price="{{settleDetailData.totalPromotionAmount || 0}}" />
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="pay-item">
|
||||
<text>优惠券</text>
|
||||
<view
|
||||
class="pay-item__right"
|
||||
data-storeid="{{settleDetailData.storeGoodsList[0].storeId}}"
|
||||
catchtap="onOpenCoupons"
|
||||
>
|
||||
<block wx:if="{{submitCouponList.length}}">
|
||||
<block wx:if="{{settleDetailData.totalCouponAmount && settleDetailData.totalCouponAmount !== '0'}}">
|
||||
-<price class="pay-item__right primary font-bold" priceUnit="yuan" fill decimalSmaller price="{{settleDetailData.totalCouponAmount}}" />
|
||||
<view class="pay-item">
|
||||
<text>运费</text>
|
||||
<view class="pay-item__right font-bold">
|
||||
<!-- <block wx:if="{{settleDetailData.totalDeliveryFee && settleDetailData.totalDeliveryFee != 0}}"> -->
|
||||
<!-- {{stores.deliveryFee}} -->
|
||||
<block wx:if="{{stores.deliveryFee && stores.deliveryFee != 0}}">
|
||||
+
|
||||
<!-- <price priceUnit="yuan" fill decimalSmaller price="{{settleDetailData.totalDeliveryFee}}" /> -->
|
||||
<price priceUnit="yuan" fill decimalSmaller price="{{stores.deliveryFee}}" />
|
||||
</block>
|
||||
<block wx:else>选择优惠券</block>
|
||||
</block>
|
||||
<text wx:else>无可用</text>
|
||||
<t-icon name="chevron-right" size="32rpx" color="#BBBBBB" />
|
||||
<text wx:else>免运费</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- <view class="pay-item" wx:if="{{settleDetailData.invoiceSupport}}">
|
||||
<view class="pay-item">
|
||||
<text>活动优惠</text>
|
||||
<view class="pay-item__right primary font-bold">
|
||||
-
|
||||
<price priceUnit="yuan" fill price="{{settleDetailData.totalPromotionAmount || 0}}" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="pay-item">
|
||||
<text>优惠券</text>
|
||||
<view class="pay-item__right" data-storeid="{{settleDetailData.storeGoodsList[0].storeId}}" catchtap="onOpenCoupons">
|
||||
<block wx:if="{{submitCouponList.length}}">
|
||||
<block wx:if="{{settleDetailData.totalCouponAmount && settleDetailData.totalCouponAmount !== '0'}}">
|
||||
-
|
||||
<price class="pay-item__right primary font-bold" priceUnit="yuan" fill decimalSmaller price="{{settleDetailData.totalCouponAmount}}" />
|
||||
</block>
|
||||
<block wx:else>选择优惠券</block>
|
||||
</block>
|
||||
<text wx:else>无可用</text>
|
||||
<t-icon name="chevron-right" size="32rpx" color="#BBBBBB" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="pay-item" wx:if="{{settleDetailData.invoiceSupport}}">
|
||||
<text>发票</text>
|
||||
<view class="pay-item__right" catchtap="onReceipt">
|
||||
<text>{{handleInvoice(invoiceData)}}</text>
|
||||
<t-icon name="chevron-right" size="32rpx" color="#BBBBBB" />
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="pay-item">
|
||||
<text>订单备注</text>
|
||||
<view class="pay-item__right" data-storenoteindex="{{0}}" catchtap="onNotes">
|
||||
<text class="pay-remark"
|
||||
>{{getNotes(storeInfoList, 0) ? getNotes(storeInfoList, 0) :'选填,建议先和商家沟通确认'}}</text
|
||||
>
|
||||
<t-icon name="chevron-right" size="32rpx" color="#BBBBBB" />
|
||||
<view class="pay-item">
|
||||
<text>订单备注</text>
|
||||
<!-- {{storeNoteIndex}} -->
|
||||
<view class="pay-item__right" data-storenoteindex="{{storeIndex}}" catchtap="onNotes">
|
||||
<text class="pay-remark">{{getNotes(storeInfoList, 0) ? getNotes(storeInfoList, 0) :'选填,建议先和商家沟通确认'}}</text>
|
||||
<t-icon name="chevron-right" size="32rpx" color="#BBBBBB" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="amount-wrapper">
|
||||
<view class="pay-amount">
|
||||
<!-- <text class="order-num">共{{settleDetailData.totalGoodsCount}}件</text> -->
|
||||
<text class="order-num">共{{stores.goodsCount}}件</text>
|
||||
<text>小计</text>
|
||||
<!-- <price priceUnit="yuan" class="total-price" price="{{settleDetailData.totalPayAmount}}" fill="{{false}}" decimalSmaller /> -->
|
||||
<price priceUnit="yuan" class="total-price" price="{{stores.storeTotalAmount}}" fill="{{false}}" decimalSmaller />
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="amount-wrapper">
|
||||
<view class="pay-amount">
|
||||
<text class="order-num">共{{settleDetailData.totalGoodsCount}}件</text>
|
||||
<text>小计</text>
|
||||
<price priceUnit="yuan" class="total-price" price="{{settleDetailData.totalPayAmount}}" fill="{{false}}" decimalSmaller />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="wx-pay-cover">
|
||||
<view class="wx-pay">
|
||||
<price priceUnit="yuan" decimalSmaller fill class="price" price="{{settleDetailData.totalPayAmount || '0'}}" />
|
||||
@ -111,42 +98,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<t-dialog
|
||||
t-class="add-notes"
|
||||
title="填写备注信息"
|
||||
visible="{{dialogShow}}"
|
||||
confirm-btn="确认"
|
||||
cancel-btn="取消"
|
||||
t-class-content="add-notes__content"
|
||||
t-class-confirm="dialog__button-confirm"
|
||||
t-class-cancel="dialog__button-cancel"
|
||||
bindconfirm="onNoteConfirm"
|
||||
bindcancel="onNoteCancel"
|
||||
>
|
||||
<t-textarea
|
||||
slot="content"
|
||||
focus="{{dialogShow}}"
|
||||
class="notes"
|
||||
t-class="add-notes__textarea"
|
||||
value="{{storeInfoList[storeNoteIndex] && storeInfoList[storeNoteIndex].remark}}"
|
||||
placeholder="备注信息"
|
||||
t-class-textarea="add-notes__textarea__font"
|
||||
bindfocus="onFocus"
|
||||
bindblur="onBlur"
|
||||
bindchange="onInput"
|
||||
maxlength="{{50}}"
|
||||
/>
|
||||
<t-dialog t-class="add-notes" title="填写备注信息" visible="{{dialogShow}}" confirm-btn="确认" cancel-btn="取消" t-class-content="add-notes__content" t-class-confirm="dialog__button-confirm" t-class-cancel="dialog__button-cancel" bindconfirm="onNoteConfirm" bindcancel="onNoteCancel">
|
||||
<t-textarea slot="content" focus="{{dialogShow}}" class="notes" t-class="add-notes__textarea" value="{{storeInfoList[storeNoteIndex] && storeInfoList[storeNoteIndex].remark}}" placeholder="备注信息" t-class-textarea="add-notes__textarea__font" bindfocus="onFocus" bindblur="onBlur" bindchange="onInput" maxlength="{{50}}" />
|
||||
</t-dialog>
|
||||
<t-popup visible="{{popupShow}}" placement="bottom" bind:visible-change="onPopupChange">
|
||||
<no-goods slot="content" bind:change="onSureCommit" settleDetailData="{{settleDetailData}}" />
|
||||
</t-popup>
|
||||
<select-coupons
|
||||
bind:sure="onCoupons"
|
||||
storeId="{{currentStoreId}}"
|
||||
orderSureCouponList="{{couponList}}"
|
||||
promotionGoodsList="{{promotionGoodsList}}"
|
||||
couponsShow="{{couponsShow}}"
|
||||
/>
|
||||
<select-coupons bind:sure="onCoupons" storeId="{{currentStoreId}}" orderSureCouponList="{{couponList}}" promotionGoodsList="{{promotionGoodsList}}" couponsShow="{{couponsShow}}" />
|
||||
</view>
|
||||
<t-toast id="t-toast" />
|
||||
<t-dialog id="t-dialog" />
|
@ -46,6 +46,14 @@
|
||||
background: #cccccc;
|
||||
}
|
||||
|
||||
.order-wrapper{
|
||||
width: 98%;
|
||||
margin: 0 auto;
|
||||
margin-bottom: 30rpx;
|
||||
border-radius: 30rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.order-wrapper .store-wrapper {
|
||||
width: 100%;
|
||||
height: 96rpx;
|
||||
|
@ -7,6 +7,7 @@
|
||||
<view class="pay-money">
|
||||
微信支付:
|
||||
<price
|
||||
priceUnit="yuan"
|
||||
wx:if="{{totalPaid}}"
|
||||
price="{{totalPaid}}"
|
||||
wr-class="pay-money__price"
|
||||
|
@ -2,7 +2,7 @@ import {
|
||||
request
|
||||
} from '../_utils/request';
|
||||
|
||||
/** 修改购物车商品数量 */
|
||||
/** 修改购物车商品选中状态 */
|
||||
export function updateCartGoodsSelect(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
|
Loading…
Reference in New Issue
Block a user