【订单确认】

1. 接入订单商品列表
pull/1/MERGE
YunaiV 2023-06-29 23:32:16 +08:00
parent 3ae38b6626
commit fe955e9fb1
3 changed files with 89 additions and 54 deletions

View File

@ -1,7 +1,17 @@
import request from "@/utils/request.js";
export function settlementOrder(data) {
return request.get("app-api/trade/order/settlement", data);
const data2 = {
...data,
}
// 解决 SpringMVC 接受 List<Item> 参数的问题
delete data2.items
for (let i = 0; i < data.items.length; i++) {
data2['items[' + i + '].skuId'] = data.items[i].skuId;
data2['items[' + i + '].count'] = data.items[i].count;
data2['items[' + i + '].cartId'] = data.items[i].cartId;
}
return request.get("app-api/trade/order/settlement", data2);
}
export function createOrder(data) {

View File

@ -1,35 +1,40 @@
<template>
<view class="orderGoods borRadius14">
<view class='total'>{{ orderProNum?orderProNum:totalNmu}}件商品</view>
<view class='total'>{{ totalNmu }}件商品</view>
<view class='goodWrapper pad30'>
<view class='item acea-row row-between-wrapper' v-for="(item,index) in cartInfo" :key="index"
@click="jumpCon(item.productId)">
@click="jumpCon(item.spuId)">
<view class='pictrue'>
<image :src='item.image'></image>
<image :src='item.picUrl' />
</view>
<view class='text'>
<view class='acea-row row-between-wrapper'>
<view class='name line1'>{{item.productName ? item.productName : item.storeName}}</view>
<view class='num'>x {{item.payNum ? item.payNum : item.cartNum}}</view>
<view class='name line1'>{{ item.spuName }}</view>
<view class='num'>x {{ item.count }}</view>
</view>
<view class='attr line1' v-if="item.sku">{{item.sku}}</view>
<view class='money font-color'>{{item.price}}</view>
<view class='evaluate' v-if='item.isReply==0 && evaluate==2' @click.stop="evaluateTap(item)">评价
<view class='attr line1'>
<text v-for="(property, propertyIndex) in item.properties" :key="propertyIndex" style="padding-right: 10rpx;">
{{ property.valueName }} 
</text>
</view>
<view class='evaluate' v-else-if="item.isReply==1">已评价</view>
<view class='money font-color'>{{ fen2yuan(item.price) }}</view>
<!-- 评价状态 -->
<view class='evaluate' v-if='item.replyStatus === false && evaluate === 2' @click.stop="evaluateTap(item)">
评价
</view>
<view class='evaluate' v-else-if="item.replyStatus === true">已评价</view>
</view>
</view>
</view>
</view>
</template>
<script>
import * as Util from '@/utils/util.js';
export default {
props: {
evaluate: {
type: Number,
default: 0,
default: 0, // 0 - 2 -
},
cartInfo: {
type: Array,
@ -49,12 +54,6 @@
type: Boolean,
default: false,
},
orderProNum: {
type: Number,
default: function() {
return 0;
}
},
productType: {
type: Number,
default: function() {
@ -64,36 +63,40 @@
},
data() {
return {
totalNmu: ''
totalNmu: 0 //
};
},
watch: {
cartInfo: function(nVal, oVal) {
let num = 0
nVal.forEach((item, index) => {
num += item.cartNum
num += item.count
})
this.totalNmu = num
}
},
methods: {
// TODO
evaluateTap(item) {
uni.navigateTo({
url: "/pages/users/goods_comment_con/index?unique=" + item.attrId + "&orderId=" + this.orderId + '&id=' + this.ids
})
},
jumpCon: function(id) {
let type = this.productType==0?'normal':'video'
let type = this.productType === 0 ?'normal':'video'
if (this.jump) {
uni.navigateTo({
url: `/pages/goods_details/index?id=${id}&type=${type}`
})
}
}
},
fen2yuan(price) {
return Util.fen2yuan(price)
},
}
}
</script>
<style scoped lang="scss">
.orderGoods {
background-color: #fff;

View File

@ -3,13 +3,13 @@
<view class='order-submission'>
<view class="allAddress" :style="store_self_mention ? '':'padding-top:10rpx;'">
<view class="nav acea-row">
<view class="item font-color" :class="shippingType === 0 ? 'on' : 'on2'"
@tap="addressType(0)" v-if='store_self_mention' />
<view class="item font-color" :class="shippingType === 1 ? 'on' : 'on2'"
@tap="addressType(0)" v-if='store_self_mention' />
<view class="item font-color" :class="shippingType === 2 ? 'on' : 'on2'"
@tap="addressType(1)" v-if='store_self_mention' />
</view>
<!-- 收货地址的选择 -->
<view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='shippingType === 0'
<view class='address acea-row row-between-wrapper' @tap='onAddress' v-if='shippingType === 1'
:style="store_self_mention ? '':'border-top-left-radius: 14rpx;border-top-right-radius: 14rpx;'">
<view class='addressCon' v-if="addressInfo.name">
<view class='name'>{{ addressInfo.name }}
@ -46,10 +46,10 @@
</view>
</view>
<view class="pad30">
<orderGoods :cartInfo="cartInfo" :orderProNum="orderProNum"></orderGoods>
<orderGoods :cartInfo="cartInfo" />
<view class='wrapper borRadius14'>
<view class='item acea-row row-between-wrapper' @tap='couponTap'
v-if="!orderInfoVo.bargainId && !orderInfoVo.combinationId && !orderInfoVo.seckillId && productType==='normal'">
v-if="orderInfoVo.type === 1 && productType==='normal'">
<view>优惠券</view>
<view class='discount'>{{couponTitle}}
<text class='iconfont icon-jiantou'></text>
@ -57,7 +57,7 @@
</view>
<view class='item acea-row row-between-wrapper'
v-if="!orderInfoVo.bargainId && !orderInfoVo.combinationId && !orderInfoVo.seckillId && productType==='normal'">
v-if="orderInfoVo.type === 1 && productType==='normal'">
<view>积分抵扣</view>
<!-- -->
<view class='discount acea-row row-middle'>
@ -74,7 +74,7 @@
<view>会员优惠</view>
<view class='discount'>-{{priceGroup.vipPrice}}</view>
</view> -->
<view class='item acea-row row-between-wrapper' v-if='shippingType==0'>
<view class='item acea-row row-between-wrapper' v-if='shippingType === 1'>
<view>快递费用</view>
<view class='discount' v-if='parseFloat(orderInfoVo.freightFee) > 0'>
+{{orderInfoVo.freightFee}}
@ -175,10 +175,10 @@
postOrderComputed,
wechatOrderPay,
wechatQueryPayResult,
loadPreOrderApi
} from '@/api/order.js';
import * as AddressApi from '@/api/member/address.js';
import * as CouponApi from '@/api/promotion/coupon.js';
import * as OrderApi from '@/api/trade/order.js';
import {
openPaySubscribe
} from '@/utils/SubscribeMessage.js';
@ -189,7 +189,7 @@
import home from '@/components/home';
import { toLogin } from '@/libs/login.js';
import { mapGetters } from "vuex";
import coupon from "../../../../admin/src/views/marketing/coupon";
import * as Util from '@/utils/util.js';
export default {
components: {
couponListWindow,
@ -199,6 +199,11 @@
},
data() {
return {
items: [], //
cartInfo: [], //
orderInfoVo: {}, //
// TODO
textareaStatus: true,
//
cartArr: [{
@ -229,7 +234,6 @@
toPay: false, //
contacts: '',
contactsTel: '',
cartInfo: [],
priceGroup: {},
animated: false,
totalPrice: 0,
@ -238,8 +242,6 @@
bargain: false, //
combination: false, //
secKill: false, //
orderInfoVo: {},
orderProNum: 0,
preOrderNo: '', //
// ========== ==========
@ -252,7 +254,7 @@
},
// ========== ==========
shippingType: 0, // 0 - 1 -
shippingType: 1, // 1 - 2 -
addressId: 0, // param id
addressInfo: {}, //
address: { //
@ -286,13 +288,24 @@
return
}
// TODO
// #ifdef H5
this.payChannel = this.$wechat.isWeixin() ? 'public' : 'weixinh5';
// #endif
// #ifdef MP
this.payChannel = 'routine';
// #endif
this.preOrderNo = options.preOrderNo || 0;
//
if (options.cartIds && options.cartIds.length > 0) {
const cartIds = options.cartIds.split(',');
this.items = cartIds.map(cartId => ({ cartId }));
} else if (options.skuId > 0) {
this.items = [{
skuId: options.skuId,
count: options.count | 1
}]
}
this.getloadPreOrder();
// address
@ -324,14 +337,23 @@
})
},
methods: {
//
/**
* 获得订单确认信息
*/
getloadPreOrder: function() {
loadPreOrderApi(this.preOrderNo).then(res => {
let orderInfoVo = res.data.orderInfoVo
OrderApi.settlementOrder({
items: this.items,
addressId: this.address.addressId > 0 && this.shippingType === 1 ? this.address.addressId : undefined,
shippingType: parseInt() + 1,
couponId: this.couponId > 0 ? this.couponId : undefined,
// TODO
}).then(res => {
const orderInfoVo = res.data
this.orderInfoVo = orderInfoVo;
this.cartInfo = orderInfoVo.orderDetailList;
this.orderProNum = orderInfoVo.orderProNum;
this.cartInfo = orderInfoVo.items;
this.address.addressId = this.addressId ? this.addressId :orderInfoVo.addressId;
// TODO
this.cartArr[1].title = '可用余额:' + orderInfoVo.userBalance;
this.cartArr[1].payStatus = parseInt(res.data.yuePayStatus) === 1 ? 1 : 2;
this.cartArr[0].payStatus = parseInt(res.data.payWeixinOpen) === 1 ? 1 : 0;
@ -340,23 +362,19 @@
this.$nextTick(function() {
this.$refs.addressWindow.getAddressList();
})
//
this.getCouponList();
}).catch(err => {
return this.$util.Tips({
title: err
});
})
// TODO
this.getCouponList();
},
//
computedPrice: function() {
let shippingType = this.shippingType;
postOrderComputed({
addressId: this.address.addressId,
useIntegral: this.useIntegral,
couponId: this.couponId,
shippingType: parseInt(shippingType) + 1,
preOrderNo: this.preOrderNo
}).then(res => {
let data = res.data;
@ -721,10 +739,10 @@
if (!that.payType) return that.$util.Tips({
title: '请选择支付方式'
});
if (!that.address.addressId && !that.shippingType) return that.$util.Tips({
if (!that.address.addressId && that.shippingType === 1) return that.$util.Tips({
title: '请选择收货地址'
});
if (that.shippingType == 1) {
if (that.shippingType == 2) {
if (that.contacts == "" || that.contactsTel == "") {
return that.$util.Tips({
title: '请填写联系人或联系人电话'
@ -894,7 +912,7 @@
addressType: function(shippingType) {
this.shippingType = shippingType;
this.computedPrice();
if (shippingType === 1) {
if (shippingType === 2) {
this.getList();
}
},
@ -927,6 +945,10 @@
});
})
},
fen2yuan(price) {
return Util.fen2yuan(price)
},
}
}
</script>