|
|
@ -1,14 +1,27 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<s-layout title="确认订单">
|
|
|
|
<s-layout title="确认订单">
|
|
|
|
<!-- TODO:这个判断先删除 v-if="state.orderInfo.need_address === 1" -->
|
|
|
|
<!-- TODO:这个判断先删除 v-if="state.orderInfo.need_address === 1" -->
|
|
|
|
<view class="bg-white address-box ss-m-b-14 ss-r-b-10" @tap="onSelectAddress">
|
|
|
|
<view class="top">
|
|
|
|
|
|
|
|
配送方式:是否自提
|
|
|
|
|
|
|
|
<switch checked @change="switch1Change" />
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="bg-white address-box ss-m-b-14 ss-r-b-10" @tap="onSelectAddress" v-if='state.deliType === 1'>
|
|
|
|
<s-address-item :item="state.addressInfo" :hasBorderBottom="false">
|
|
|
|
<s-address-item :item="state.addressInfo" :hasBorderBottom="false">
|
|
|
|
<view class="ss-rest-button">
|
|
|
|
<view class="ss-rest-button">
|
|
|
|
<text class="_icon-forward" />
|
|
|
|
<text class="_icon-forward" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</s-address-item>
|
|
|
|
</s-address-item>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="pickUpInfo" @tap="onSelectAddress1" v-else>
|
|
|
|
|
|
|
|
<view>
|
|
|
|
|
|
|
|
<view>门店信息</view>
|
|
|
|
|
|
|
|
<view>{{state.pickUpInfo.detailAddress}}</view>
|
|
|
|
|
|
|
|
<view>{{state.pickUpInfo.areaName}}</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="ss-rest-button">
|
|
|
|
|
|
|
|
<text class="_icon-forward" />
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
<!-- 商品信息 -->
|
|
|
|
<!-- 商品信息 -->
|
|
|
|
<view class="order-card-box ss-m-b-14">
|
|
|
|
<view class="order-card-box ss-m-b-14">
|
|
|
|
<s-goods-item
|
|
|
|
<s-goods-item
|
|
|
@ -173,6 +186,8 @@
|
|
|
|
items: [], // 商品项列表
|
|
|
|
items: [], // 商品项列表
|
|
|
|
price: {}, // 价格信息
|
|
|
|
price: {}, // 价格信息
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
deliType:2,
|
|
|
|
|
|
|
|
pickUpInfo:{},//门店信息
|
|
|
|
addressInfo: {}, // 选择的收货地址
|
|
|
|
addressInfo: {}, // 选择的收货地址
|
|
|
|
showCoupon: false, // 是否展示优惠劵
|
|
|
|
showCoupon: false, // 是否展示优惠劵
|
|
|
|
couponInfo: [], // 优惠劵列表
|
|
|
|
couponInfo: [], // 优惠劵列表
|
|
|
@ -180,13 +195,24 @@
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 选择地址
|
|
|
|
// 选择地址
|
|
|
|
|
|
|
|
function onSelectAddress1() {
|
|
|
|
|
|
|
|
uni.$once('SELECT_ADDRESS1', (e) => {
|
|
|
|
|
|
|
|
changeConsignee1(e.pickUpInfo);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
sheep.$router.go('/pages/user/address/listt');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeConsignee1(pickUpInfo = {}) {
|
|
|
|
|
|
|
|
if (!isEmpty(pickUpInfo)) {
|
|
|
|
|
|
|
|
state.pickUpInfo = pickUpInfo;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////
|
|
|
|
function onSelectAddress() {
|
|
|
|
function onSelectAddress() {
|
|
|
|
uni.$once('SELECT_ADDRESS', (e) => {
|
|
|
|
uni.$once('SELECT_ADDRESS', (e) => {
|
|
|
|
changeConsignee(e.addressInfo);
|
|
|
|
changeConsignee(e.addressInfo);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
sheep.$router.go('/pages/user/address/list');
|
|
|
|
sheep.$router.go('/pages/user/address/list');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更改收货人地址&计算订单信息
|
|
|
|
// 更改收货人地址&计算订单信息
|
|
|
|
async function changeConsignee(addressInfo = {}) {
|
|
|
|
async function changeConsignee(addressInfo = {}) {
|
|
|
|
if (!isEmpty(addressInfo)) {
|
|
|
|
if (!isEmpty(addressInfo)) {
|
|
|
@ -210,14 +236,22 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
submitOrder();
|
|
|
|
submitOrder();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//是否自提
|
|
|
|
|
|
|
|
const switch1Change = ()=>{
|
|
|
|
|
|
|
|
if(state.deliType == 1){
|
|
|
|
|
|
|
|
state.deliType = 2
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
state.deliType = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// 创建订单&跳转
|
|
|
|
// 创建订单&跳转
|
|
|
|
async function submitOrder() {
|
|
|
|
async function submitOrder() {
|
|
|
|
const { code, data } = await OrderApi.createOrder({
|
|
|
|
const { code, data } = await OrderApi.createOrder({
|
|
|
|
items: state.orderPayload.items,
|
|
|
|
items: state.orderPayload.items,
|
|
|
|
couponId: state.orderPayload.couponId,
|
|
|
|
couponId: state.orderPayload.couponId,
|
|
|
|
addressId: state.addressInfo.id,
|
|
|
|
addressId: state.deliType === 1 ? state.addressInfo.id: null,
|
|
|
|
deliveryType: 1, // TODO 芋艿:需要支持【门店自提】
|
|
|
|
pickUpStoreId:state.deliType === 2 ? state.pickUpInfo.id : null,
|
|
|
|
|
|
|
|
deliveryType: state.deliType, // TODO 芋艿:需要支持【门店自提】
|
|
|
|
pointStatus: false, // TODO 芋艿:需要支持【积分选择】
|
|
|
|
pointStatus: false, // TODO 芋艿:需要支持【积分选择】
|
|
|
|
combinationActivityId: state.orderPayload.combinationActivityId,
|
|
|
|
combinationActivityId: state.orderPayload.combinationActivityId,
|
|
|
|
combinationHeadId: state.orderPayload.combinationHeadId,
|
|
|
|
combinationHeadId: state.orderPayload.combinationHeadId,
|
|
|
@ -284,6 +318,14 @@
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
.pickUpInfo{
|
|
|
|
|
|
|
|
display:flex;
|
|
|
|
|
|
|
|
background-color: white;
|
|
|
|
|
|
|
|
align-items: center ;
|
|
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
margin-bottom: 2vw;
|
|
|
|
|
|
|
|
padding: 2vw;
|
|
|
|
|
|
|
|
}
|
|
|
|
:deep() {
|
|
|
|
:deep() {
|
|
|
|
.uni-input-wrapper {
|
|
|
|
.uni-input-wrapper {
|
|
|
|
width: 320rpx;
|
|
|
|
width: 320rpx;
|
|
|
|