Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b42aeac188
36
mobile-web/src/api/order.js
Normal file
36
mobile-web/src/api/order.js
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import request from "../config/request";
|
||||||
|
|
||||||
|
|
||||||
|
export function getOrderPage(params) {
|
||||||
|
return request({
|
||||||
|
url: '/order-api/users/order/order_page',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cancelOrder(id) {
|
||||||
|
return request({
|
||||||
|
url: '/product-api/users/spu/info',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createOrder(params) {
|
||||||
|
return request({
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
url: '/order-api/users/order/create_order',
|
||||||
|
method: 'post',
|
||||||
|
data: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ import request from "../config/request";
|
|||||||
|
|
||||||
export function getProductCategoryList(pid) {
|
export function getProductCategoryList(pid) {
|
||||||
return request({
|
return request({
|
||||||
url: 'product-api/users/category/list',
|
url: '/product-api/users/category/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
pid
|
pid
|
||||||
@ -12,7 +12,7 @@ export function getProductCategoryList(pid) {
|
|||||||
|
|
||||||
export function getProductSpuPage(cid, pageNo, pageSize) {
|
export function getProductSpuPage(cid, pageNo, pageSize) {
|
||||||
return request({
|
return request({
|
||||||
url: 'product-api/users/spu/page',
|
url: '/product-api/users/spu/page',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
cid,
|
cid,
|
||||||
@ -24,10 +24,10 @@ export function getProductSpuPage(cid, pageNo, pageSize) {
|
|||||||
|
|
||||||
export function getProductSpuInfo(id) {
|
export function getProductSpuInfo(id) {
|
||||||
return request({
|
return request({
|
||||||
url: 'product-api/users/spu/info',
|
url: '/product-api/users/spu/info',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
id,
|
id,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@ export function getProductRecommendList() {
|
|||||||
return request({
|
return request({
|
||||||
url: '/promotion-api/users/product_recommend/list',
|
url: '/promotion-api/users/product_recommend/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +43,7 @@ export function doAddCouponCard(templateId) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Coupon Card
|
// Coupon Card
|
||||||
|
|
||||||
export function getCouponPage(status, pageNo, pageSize) {
|
export function getCouponPage(status, pageNo, pageSize) {
|
||||||
|
@ -74,7 +74,7 @@ export function ExchangeCoupon(code){
|
|||||||
|
|
||||||
export function getUserInfo() {
|
export function getUserInfo() {
|
||||||
return request({
|
return request({
|
||||||
url: 'user-api/users/user/info',
|
url: '/user-api/users/user/info',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,79 +1,89 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<ul :class="'cap-goods-list__container cap-goods-list__container--'+data.classname+' cap-goods-list__container--'+data.ParameterDictionary.showtype+' '+(data.ParameterDictionary.type=='6'?'nowrap':'')" >
|
<ul
|
||||||
<li v-if="productlist.length==0" style="width:100%;height:150px;border:0px;">
|
:class="'cap-goods-list__container cap-goods-list__container--'+data.classname+' cap-goods-list__container--'+data.ParameterDictionary.showtype+' '+(data.ParameterDictionary.type=='6'?'nowrap':'')">
|
||||||
<div style="width:100%;height:150px;"></div>
|
<li v-if="productlist.length==0" style="width:100%;height:150px;border:0px;">
|
||||||
</li>
|
<div style="width:100%;height:150px;"></div>
|
||||||
<li v-for="(item,index) in productlist" :key="index" :class="'cap-goods-list__wrapper '+(data.ParameterDictionary.type=='3'?(index%3==0?'cap-goods-list__wrapper--hybrid-big ':'cap-goods-list__wrapper--hybrid-small '):'')">
|
</li>
|
||||||
<router-link :class="'cap-goods-list__item cap-goods-list__item--'+data.classname+' '+data.ParameterDictionary.showtype+' '+data.aclass" :to="'/product/'+item.id">
|
<li v-for="(item,index) in productlist" :key="index"
|
||||||
<div class="cap-goods-list__photo">
|
:class="'cap-goods-list__wrapper '+(data.ParameterDictionary.type=='3'?(index%3==0?'cap-goods-list__wrapper--hybrid-big ':'cap-goods-list__wrapper--hybrid-small '):'')">
|
||||||
<img class="cap-goods-list__img lazy lazyload" v-lazy="item.imageURL+'?w='+((data.ParameterDictionary.type=='1'||data.ParameterDictionary.type=='3')?'750':'375')" />
|
<router-link
|
||||||
</div>
|
:class="'cap-goods-list__item cap-goods-list__item--'+data.classname+' '+data.ParameterDictionary.showtype+' '+data.aclass"
|
||||||
<div :class="'cap-goods-list__info has-title has-price '+(data.ParameterDictionary.showtype == 'card'?'has-btn':'')">
|
:to="'/product/'+item.id">
|
||||||
<h3 class="title">{{item.title}}</h3>
|
<div class="cap-goods-list__photo">
|
||||||
<p class="sale-info">
|
<img class="cap-goods-list__img lazy lazyload"
|
||||||
<span class="sale-price">¥ {{item.price}}</span>
|
v-lazy="item.imageURL+'?w='+((data.ParameterDictionary.type=='1'||data.ParameterDictionary.type=='3')?'750':'375')"/>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
<div
|
||||||
<div v-if="data.ParameterDictionary.showtype == 'card'" class="cap-goods-list__buy-btn-wrapper cap-goods-list__buy-btn-wrapper--4">
|
:class="'cap-goods-list__info has-title has-price '+(data.ParameterDictionary.showtype == 'card'?'has-btn':'')">
|
||||||
<button class="cap-goods-list__buy-btn-4 van-button van-button--default van-button--small">{{data.ParameterDictionary.buttonvalue}}</button>
|
<h3 class="title">{{item.title}}</h3>
|
||||||
</div>
|
<p class="sale-info">
|
||||||
</router-link>
|
<span class="sale-price">¥ {{item.price}}</span>
|
||||||
</li>
|
</p>
|
||||||
|
</div>
|
||||||
|
<div v-if="data.ParameterDictionary.showtype == 'card'"
|
||||||
|
class="cap-goods-list__buy-btn-wrapper cap-goods-list__buy-btn-wrapper--4">
|
||||||
|
<button
|
||||||
|
class="cap-goods-list__buy-btn-4 van-button van-button--default van-button--small">
|
||||||
|
{{data.ParameterDictionary.buttonvalue}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getProduct} from "../../api/page.js";
|
import {getProduct} from "../../api/page.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name:'product',
|
name: 'product',
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
productlist: []
|
productlist: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props:{
|
props: {
|
||||||
data:Object
|
data: Object
|
||||||
},
|
},
|
||||||
created:function(){
|
created: function () {
|
||||||
var id=this.data.PageSectionId;
|
var id = this.data.PageSectionId;
|
||||||
var data=this.data;
|
var data = this.data;
|
||||||
var classname = "big";
|
var classname = "big";
|
||||||
var aclass = "";
|
var aclass = "";
|
||||||
switch (data.ParameterDictionary.type) {
|
switch (data.ParameterDictionary.type) {
|
||||||
case "1":
|
case "1":
|
||||||
aclass = "cap-goods-list__item--btn1 cap-goods-list__item--ratio-3-2 cap-goods-list__item--whitespace";
|
aclass = "cap-goods-list__item--btn1 cap-goods-list__item--ratio-3-2 cap-goods-list__item--whitespace";
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
classname = "small";
|
classname = "small";
|
||||||
aclass = "cap-goods-list__item--btn1 cap-goods-list__item--padding";
|
aclass = "cap-goods-list__item--btn1 cap-goods-list__item--padding";
|
||||||
break;
|
break;
|
||||||
case "3":
|
case "3":
|
||||||
classname = "hybrid";
|
classname = "hybrid";
|
||||||
aclass = "cap-goods-list__item--big cap-goods-list__item--hybrid-big cap-goods-list__item--btn1 cap-goods-list__item--padding";
|
aclass = "cap-goods-list__item--big cap-goods-list__item--hybrid-big cap-goods-list__item--btn1 cap-goods-list__item--padding";
|
||||||
break;
|
break;
|
||||||
case "4":
|
case "4":
|
||||||
classname = "list";
|
classname = "list";
|
||||||
aclass = "cap-goods-list__item--btn4 cap-goods-list__item--padding";
|
aclass = "cap-goods-list__item--btn4 cap-goods-list__item--padding";
|
||||||
break;
|
break;
|
||||||
case "5":
|
case "5":
|
||||||
classname = "three";
|
classname = "three";
|
||||||
aclass = "cap-goods-list__item--btn4 cap-goods-list__item--padding";
|
aclass = "cap-goods-list__item--btn4 cap-goods-list__item--padding";
|
||||||
break;
|
break;
|
||||||
case "6":
|
case "6":
|
||||||
classname = "three";
|
classname = "three";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data.classname=classname;
|
data.classname = classname;
|
||||||
data.aclass=aclass;
|
data.aclass = aclass;
|
||||||
getProduct(id).then(response => {
|
getProduct(id).then(response => {
|
||||||
this.productlist=response;
|
this.productlist = response;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -15,9 +15,13 @@ const serviceRouter = function(requestUrl) {
|
|||||||
prefix: '/user-api',
|
prefix: '/user-api',
|
||||||
target: 'http://127.0.0.1:18082/user-api',
|
target: 'http://127.0.0.1:18082/user-api',
|
||||||
},
|
},
|
||||||
|
'/product-api': {
|
||||||
|
prefix: '/product-api',
|
||||||
|
target: 'http://127.0.0.1:18081/product-api',
|
||||||
|
},
|
||||||
'/promotion-api': {
|
'/promotion-api': {
|
||||||
prefix: '/promotion-api',
|
prefix: '/promotion-api',
|
||||||
target: 'http://127.0.0.1:18085/promotion-api',
|
target: 'http://127.0.0.1:18085//promotion-api',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -30,9 +34,13 @@ const serviceRouter = function(requestUrl) {
|
|||||||
prefix: '/user-api',
|
prefix: '/user-api',
|
||||||
target: 'http://127.0.0.1:18082/user-api',
|
target: 'http://127.0.0.1:18082/user-api',
|
||||||
},
|
},
|
||||||
|
'/product-api': {
|
||||||
|
prefix: '/product-api',
|
||||||
|
target: 'http://127.0.0.1:18081/product-api',
|
||||||
|
},
|
||||||
'/promotion-api': {
|
'/promotion-api': {
|
||||||
prefix: '/promotion-api',
|
prefix: '/promotion-api',
|
||||||
target: 'http://127.0.0.1:18085/promotion-api',
|
target: 'http://127.0.0.1:18085//promotion-api',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -65,7 +73,9 @@ const serviceRouter = function(requestUrl) {
|
|||||||
const indexOf = requestUrl.indexOf("/", 1);
|
const indexOf = requestUrl.indexOf("/", 1);
|
||||||
const _urlPrefix = requestUrl.substring(0, indexOf);
|
const _urlPrefix = requestUrl.substring(0, indexOf);
|
||||||
if (!config[_urlPrefix]) {
|
if (!config[_urlPrefix]) {
|
||||||
throw new Error(`服务路由,未找到可用服务! ${requestUrl}`);
|
// throw new Error(`服务路由,未找到可用服务! ${requestUrl}`);
|
||||||
|
console.error(`服务路由,未找到可用服务! ${requestUrl}`)
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
// if (!createServer[_urlPrefix]) {
|
// if (!createServer[_urlPrefix]) {
|
||||||
// throw new Error("服务路由,未找到可用服务!");
|
// throw new Error("服务路由,未找到可用服务!");
|
||||||
|
@ -181,6 +181,13 @@ const routes = [
|
|||||||
title: '确认订单'
|
title: '确认订单'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/order/success',
|
||||||
|
component: () => import('../page/shipping/order-success'),
|
||||||
|
meta: {
|
||||||
|
title: '确认订单'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'category',
|
name: 'category',
|
||||||
component: () => import('../page/category/index'),
|
component: () => import('../page/category/index'),
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="goods">
|
<div class="goods">
|
||||||
<headerNav title="商品详情"/>
|
<headerNav title="商品详情"/>
|
||||||
<van-swipe class="goods-swipe" :autoplay="3000">
|
<van-swipe class="goods-swipe" :autoplay="3000">
|
||||||
<van-swipe-item v-for="thumb in spu.picUrls" :key="thumb">
|
<van-swipe-item v-for="thumb in spu.picUrls" :key="thumb">
|
||||||
<img :src="thumb" >
|
<img :src="thumb">
|
||||||
</van-swipe-item>
|
</van-swipe-item>
|
||||||
</van-swipe>
|
</van-swipe>
|
||||||
|
|
||||||
@ -14,63 +14,63 @@
|
|||||||
<div class="goods-title">{{ spu.name }}</div>
|
<div class="goods-title">{{ spu.name }}</div>
|
||||||
<div class="goods-subtit">{{spu.sellPoint}}</div>
|
<div class="goods-subtit">{{spu.sellPoint}}</div>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
|
|
||||||
<!--<van-cell @click="onClickShowTag" class="goods-tag" >-->
|
<!--<van-cell @click="onClickShowTag" class="goods-tag" >-->
|
||||||
<!--<template slot="title" style="font-size:10px;">-->
|
<!--<template slot="title" style="font-size:10px;">-->
|
||||||
<!--<img src="https://haitao.nos.netease.com/ba8a4c2fdaa54f82a45261293c116af61419663676663i46n3jlh10028.png"/>-->
|
<!--<img src="https://haitao.nos.netease.com/ba8a4c2fdaa54f82a45261293c116af61419663676663i46n3jlh10028.png"/>-->
|
||||||
<!--<span >挪威品牌</span>-->
|
<!--<span >挪威品牌</span>-->
|
||||||
<!--<img src="https://haitao.nosdn2.127.net/13bd59e6e29a4f06b278c586629e690d.png" />-->
|
<!--<img src="https://haitao.nosdn2.127.net/13bd59e6e29a4f06b278c586629e690d.png" />-->
|
||||||
<!--<span >跨境商品</span>-->
|
<!--<span >跨境商品</span>-->
|
||||||
<!--<van-icon name="passed" color="red" />-->
|
<!--<van-icon name="passed" color="red" />-->
|
||||||
<!--<span >次日达</span>-->
|
<!--<span >次日达</span>-->
|
||||||
<!--<van-icon name="passed" color="red" />-->
|
<!--<van-icon name="passed" color="red" />-->
|
||||||
<!--<span >自提</span>-->
|
<!--<span >自提</span>-->
|
||||||
<!--<van-icon name="passed" color="red" />-->
|
<!--<van-icon name="passed" color="red" />-->
|
||||||
<!--<span >闪电退款</span>-->
|
<!--<span >闪电退款</span>-->
|
||||||
<!--<van-icon name="passed" color="red" />-->
|
<!--<van-icon name="passed" color="red" />-->
|
||||||
<!--<span >前海保税仓</span>-->
|
<!--<span >前海保税仓</span>-->
|
||||||
<!--<van-icon name="passed" color="red" />-->
|
<!--<van-icon name="passed" color="red" />-->
|
||||||
<!--<span >七天无理由退货(拆封后不支持)</span>-->
|
<!--<span >七天无理由退货(拆封后不支持)</span>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell> -->
|
<!--</van-cell> -->
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
|
|
||||||
<!--<van-cell-group class="goods-cell-group">-->
|
<!--<van-cell-group class="goods-cell-group">-->
|
||||||
<!--<van-cell is-link @click="showPromotion" >-->
|
<!--<van-cell is-link @click="showPromotion" >-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<span style="margin-right: 10px;">领券</span>-->
|
<!--<span style="margin-right: 10px;">领券</span>-->
|
||||||
<!--<van-tag type="danger" mark style="margin-right: 5px;">满180减30</van-tag>-->
|
<!--<van-tag type="danger" mark style="margin-right: 5px;">满180减30</van-tag>-->
|
||||||
<!--<van-tag type="danger" mark style="margin-right: 5px;">满300减100</van-tag>-->
|
<!--<van-tag type="danger" mark style="margin-right: 5px;">满300减100</van-tag>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!---->
|
<!---->
|
||||||
<!--<van-cell is-link @click="showPromotion" >-->
|
<!--<van-cell is-link @click="showPromotion" >-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<span style="margin-right: 10px;">促销</span>-->
|
<!--<span style="margin-right: 10px;">促销</span>-->
|
||||||
<!--<van-tag type="danger" style="margin-right: 5px;">多买优惠</van-tag>-->
|
<!--<van-tag type="danger" style="margin-right: 5px;">多买优惠</van-tag>-->
|
||||||
<!--<van-tag type="danger" style="margin-right: 5px;">满减</van-tag>-->
|
<!--<van-tag type="danger" style="margin-right: 5px;">满减</van-tag>-->
|
||||||
<!--<van-tag type="danger" style="margin-right: 5px;">限购</van-tag>-->
|
<!--<van-tag type="danger" style="margin-right: 5px;">限购</van-tag>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--</van-cell-group>-->
|
<!--</van-cell-group>-->
|
||||||
|
|
||||||
<van-cell-group class="goods-cell-group">
|
<van-cell-group class="goods-cell-group">
|
||||||
<van-cell is-link @click="showSku" >
|
<van-cell is-link @click="showSku">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<span style="margin-right: 10px;">已选</span>
|
<span style="margin-right: 10px;">已选</span>
|
||||||
<span>{{ formatSkuText(initialSku) }}</span>
|
<span>{{ formatSkuText(initialSku) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
|
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="goods-info">
|
<div class="goods-info">
|
||||||
<p class="goods-info-title" >图文详情</p>
|
<p class="goods-info-title">图文详情</p>
|
||||||
<div v-html="spu.description"></div>
|
<div v-html="spu.description"></div>
|
||||||
</div>
|
</div>
|
||||||
<van-goods-action>
|
<van-goods-action>
|
||||||
|
|
||||||
<van-goods-action-mini-btn icon="like-o" @click="sorry">
|
<van-goods-action-mini-btn icon="like-o" @click="sorry">
|
||||||
收藏
|
收藏
|
||||||
</van-goods-action-mini-btn>
|
</van-goods-action-mini-btn>
|
||||||
@ -86,320 +86,349 @@
|
|||||||
</van-goods-action>
|
</van-goods-action>
|
||||||
|
|
||||||
<!--<van-actionsheet v-model="show" title="促销" style="font-size:14px;">-->
|
<!--<van-actionsheet v-model="show" title="促销" style="font-size:14px;">-->
|
||||||
<!---->
|
<!---->
|
||||||
<!--<van-cell is-link @click="sorry" >-->
|
<!--<van-cell is-link @click="sorry" >-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-tag type="danger">多买优惠</van-tag>-->
|
<!--<van-tag type="danger">多买优惠</van-tag>-->
|
||||||
<!--<span> 满2件,总价打9折</span>-->
|
<!--<span> 满2件,总价打9折</span>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--<van-cell is-link @click="sorry" >-->
|
<!--<van-cell is-link @click="sorry" >-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-tag type="danger">满减</van-tag>-->
|
<!--<van-tag type="danger">满减</van-tag>-->
|
||||||
<!--<span> 满100元减50元</span>-->
|
<!--<span> 满100元减50元</span>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--<van-cell is-link @click="sorry" >-->
|
<!--<van-cell is-link @click="sorry" >-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-tag type="danger">限购</van-tag>-->
|
<!--<van-tag type="danger">限购</van-tag>-->
|
||||||
<!--<span> 购买不超过5件时享受单件价¥8.00,超出数量以结算价为准</span>-->
|
<!--<span> 购买不超过5件时享受单件价¥8.00,超出数量以结算价为准</span>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--</van-actionsheet>-->
|
<!--</van-actionsheet>-->
|
||||||
|
|
||||||
<!--<van-actionsheet v-model="showTag" title="服务说明" style="font-size:14px;">-->
|
<!--<van-actionsheet v-model="showTag" title="服务说明" style="font-size:14px;">-->
|
||||||
<!---->
|
<!---->
|
||||||
<!--<van-cell>-->
|
<!--<van-cell>-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
||||||
<!--<span >次日达</span>-->
|
<!--<span >次日达</span>-->
|
||||||
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">指定时间前下单,次日送达</div>-->
|
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">指定时间前下单,次日送达</div>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--<van-cell>-->
|
<!--<van-cell>-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
||||||
<!--<span >自提</span>-->
|
<!--<span >自提</span>-->
|
||||||
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">我们提供多种自提服务,包括自提点、自助提货柜、移动自提车等服务</div>-->
|
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">我们提供多种自提服务,包括自提点、自助提货柜、移动自提车等服务</div>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--<van-cell>-->
|
<!--<van-cell>-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
||||||
<!--<span >闪电退款</span>-->
|
<!--<span >闪电退款</span>-->
|
||||||
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">签收7天内退货的,提供先退款后退货服务。</div>-->
|
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">签收7天内退货的,提供先退款后退货服务。</div>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--<van-cell>-->
|
<!--<van-cell>-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
||||||
<!--<span >七天无理由退货(拆封后不支持)</span>-->
|
<!--<span >七天无理由退货(拆封后不支持)</span>-->
|
||||||
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">七天无理由退货(拆封后不支持)</div>-->
|
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">七天无理由退货(拆封后不支持)</div>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--<van-cell>-->
|
<!--<van-cell>-->
|
||||||
<!--<template slot="title">-->
|
<!--<template slot="title">-->
|
||||||
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
<!--<van-icon name="passed" color="red" style="margin-right: 10px;" />-->
|
||||||
<!--<span >前海保税仓</span>-->
|
<!--<span >前海保税仓</span>-->
|
||||||
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">本商品由前海保税仓发货</div>-->
|
<!--<div style="margin-left: 24px;font-size:10px;color:#7d7d7d;">本商品由前海保税仓发货</div>-->
|
||||||
<!--</template>-->
|
<!--</template>-->
|
||||||
<!--</van-cell>-->
|
<!--</van-cell>-->
|
||||||
<!--</van-actionsheet>-->
|
<!--</van-actionsheet>-->
|
||||||
|
|
||||||
<van-sku
|
<van-sku
|
||||||
v-model="showBase"
|
v-model="showBase"
|
||||||
:sku="vanSku"
|
:sku="vanSku"
|
||||||
:initial-sku="initialSku"
|
:initial-sku="initialSku"
|
||||||
:goods="vanSpu"
|
:goods="vanSpu"
|
||||||
:goods-id="spu.id"
|
:goods-id="spu.id"
|
||||||
:hide-stock="hideStock"
|
:hide-stock="hideStock"
|
||||||
:close-on-click-overlay="closeOnClickOverlay"
|
:close-on-click-overlay="closeOnClickOverlay"
|
||||||
@stepper-change="stepperChange"
|
@stepper-change="stepperChange"
|
||||||
@sku-selected="skuSelected"
|
@sku-selected="skuSelected"
|
||||||
@buy-clicked="onBuyClicked"
|
@buy-clicked="onBuyClicked"
|
||||||
@add-cart="onAddCartClicked"
|
@add-cart="onAddCartClicked"
|
||||||
/>
|
/>
|
||||||
<!--:quota="skuData.quota"-->
|
<!--:quota="skuData.quota"-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import skuData from '../../data/sku';
|
// import skuData from '../../data/sku';
|
||||||
import { getProductSpuInfo } from '../../api/product';
|
import {getProductSpuInfo} from '../../api/product';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {},
|
||||||
},
|
data() {
|
||||||
data() {
|
// this.skuData = skuData;
|
||||||
// this.skuData = skuData;
|
return {
|
||||||
return {
|
spu: {}, // 商品信息
|
||||||
spu: {}, // 商品信息
|
vanSku: {
|
||||||
vanSku: {
|
tree: [], // 规格数组
|
||||||
tree: [], // 规格数组
|
list: [], // sku 数组
|
||||||
list: [], // sku 数组
|
},
|
||||||
},
|
// TODO 后面,要加 sku 的 title 和 picture
|
||||||
// TODO 后面,要加 sku 的 title 和 picture
|
vanSpu: {
|
||||||
vanSpu: {
|
title: '',
|
||||||
title: '',
|
picture: '',
|
||||||
picture: '',
|
},
|
||||||
},
|
initialSku: { // 选中的 sku
|
||||||
initialSku: { // 选中的 sku
|
// 具体规格
|
||||||
// 具体规格
|
// price 价格
|
||||||
// price 价格
|
// quantity 选中的数量
|
||||||
// quantity 选中的数量
|
},
|
||||||
},
|
attrValueMap: new Map(), // 规格值的映射
|
||||||
attrValueMap: new Map(), // 规格值的映射
|
|
||||||
|
|
||||||
// show:false,
|
// show:false,
|
||||||
// showTag:false,
|
// showTag:false,
|
||||||
// goods: {
|
// goods: {
|
||||||
// title: '【每日一粒益智又长高】 Lifeline Care 儿童果冻鱼油DHA维生素D3聪明长高 软糖 30粒 2件装',
|
// title: '【每日一粒益智又长高】 Lifeline Care 儿童果冻鱼油DHA维生素D3聪明长高 软糖 30粒 2件装',
|
||||||
// subtitle:'【品牌直采】Q弹美味,无腥味果冻鱼油,每粒含足量鱼油DHA,帮助视网膜和大脑健康发育,让你的宝宝明眼又聪明,同时补充400国际单位维生素D3,强壮骨骼和牙齿。特含DPA,让宝宝免疫力更强,没病来扰。',
|
// subtitle:'【品牌直采】Q弹美味,无腥味果冻鱼油,每粒含足量鱼油DHA,帮助视网膜和大脑健康发育,让你的宝宝明眼又聪明,同时补充400国际单位维生素D3,强壮骨骼和牙齿。特含DPA,让宝宝免疫力更强,没病来扰。',
|
||||||
// price: 2680,
|
// price: 2680,
|
||||||
// market_price:9999,
|
// market_price:9999,
|
||||||
// express: '免运费',
|
// express: '免运费',
|
||||||
// remain: 19,
|
// remain: 19,
|
||||||
// thumb: [
|
// thumb: [
|
||||||
// 'https://img.yzcdn.cn/public_files/2017/10/24/e5a5a02309a41f9f5def56684808d9ae.jpeg',
|
// 'https://img.yzcdn.cn/public_files/2017/10/24/e5a5a02309a41f9f5def56684808d9ae.jpeg',
|
||||||
// 'https://img.yzcdn.cn/public_files/2017/10/24/1791ba14088f9c2be8c610d0a6cc0f93.jpeg'
|
// 'https://img.yzcdn.cn/public_files/2017/10/24/1791ba14088f9c2be8c610d0a6cc0f93.jpeg'
|
||||||
// ],
|
// ],
|
||||||
// info:'<p style="text-align:center;"><img src="https://haitao.nosdn2.127.net/ac19460151ee4d95a6657202bcfc653c1531470912089jjjq8ml410763.jpg" ></p><p style="text-align:center;"><img src="https://haitao.nos.netease.com/2a91cfad22404e5498d347672b1440301531470912182jjjq8mnq10764.jpg" ></p><p style="text-align:center;"><img src="https://haitao.nos.netease.com/caddd5a213de4c1cb1347c267e8275731531470912412jjjq8mu410765.jpg" ></p>',
|
// info:'<p style="text-align:center;"><img src="https://haitao.nosdn2.127.net/ac19460151ee4d95a6657202bcfc653c1531470912089jjjq8ml410763.jpg" ></p><p style="text-align:center;"><img src="https://haitao.nos.netease.com/2a91cfad22404e5498d347672b1440301531470912182jjjq8mnq10764.jpg" ></p><p style="text-align:center;"><img src="https://haitao.nos.netease.com/caddd5a213de4c1cb1347c267e8275731531470912412jjjq8mu410765.jpg" ></p>',
|
||||||
// },
|
// },
|
||||||
|
|
||||||
showBase: false, // 是否显示 sku 坦诚
|
showBase: false, // 是否显示 sku 坦诚
|
||||||
closeOnClickOverlay: true, // 是否在点击蒙层后关闭
|
closeOnClickOverlay: true, // 是否在点击蒙层后关闭
|
||||||
hideStock: true, // 是否显示商品剩余库存
|
hideStock: true, // 是否显示商品剩余库存
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
formatPrice(data) {
|
|
||||||
return '¥' + (data / 100).toFixed(2);
|
|
||||||
},
|
},
|
||||||
formatSkuText(data) { // 渲染已选择的 sku 的文本
|
methods: {
|
||||||
let text = '';
|
formatPrice(data) {
|
||||||
for (let prop in data) {
|
return '¥' + (data / 100).toFixed(2);
|
||||||
if (prop.indexOf('attr_') === 0) {
|
},
|
||||||
text = text + this.attrValueMap.get(data[prop]) + ' ';
|
formatSkuText(data) { // 渲染已选择的 sku 的文本
|
||||||
|
let text = '';
|
||||||
|
for (let prop in data) {
|
||||||
|
if (prop.indexOf('attr_') === 0) {
|
||||||
|
text = text + this.attrValueMap.get(data[prop]) + ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
text = text + 'x ' + data.quantity + ' 件';
|
||||||
text = text + 'x ' + data.quantity + ' 件';
|
return text;
|
||||||
return text;
|
},
|
||||||
},
|
|
||||||
|
|
||||||
stepperChange(value) { // 选择 sku 数量时
|
stepperChange(value) { // 选择 sku 数量时
|
||||||
this.initialSku.quantity = value;
|
this.initialSku.quantity = value;
|
||||||
},
|
},
|
||||||
skuSelected({skuValue, selectedSku, selectedSkuComb}) { // 选择 sku
|
skuSelected({skuValue, selectedSku, selectedSkuComb}) { // 选择 sku
|
||||||
console.log(skuValue);
|
console.log(skuValue);
|
||||||
console.log(selectedSku);
|
console.log(selectedSku);
|
||||||
console.log(selectedSkuComb);
|
console.log(selectedSkuComb);
|
||||||
this.initialSku = {
|
this.initialSku = {
|
||||||
...selectedSkuComb,
|
...selectedSkuComb,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
onClickCart() {
|
|
||||||
this.$router.push('/cart');
|
|
||||||
},
|
|
||||||
sorry() {
|
|
||||||
Toast('暂无后续逻辑~');
|
|
||||||
},
|
|
||||||
showPromotion() {
|
|
||||||
this.show=true;
|
|
||||||
},
|
|
||||||
showSku() { // 展示 sku 选择
|
|
||||||
this.showBase=true;
|
|
||||||
},
|
|
||||||
onClickShowTag(){
|
|
||||||
this.showTag=true;
|
|
||||||
},
|
|
||||||
onBuyClicked(data) {
|
|
||||||
this.$toast(JSON.stringify(data));
|
|
||||||
},
|
|
||||||
onAddCartClicked(data) {
|
|
||||||
this.$toast(JSON.stringify(data));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let id = this.$route.params.id; // 商品编号
|
|
||||||
let response = getProductSpuInfo(id);
|
|
||||||
response.then(data => {
|
|
||||||
// 设置 spu
|
|
||||||
this.spu = data;
|
|
||||||
// 初始化 vanSku
|
|
||||||
let vanSku = {
|
|
||||||
tree: [],
|
|
||||||
list: [],
|
|
||||||
};
|
|
||||||
for (let i = 0; i < data.skus.length; i++) {
|
|
||||||
let sku = data.skus[i];
|
|
||||||
// list 商品 sku 信息
|
|
||||||
let skuVO = {
|
|
||||||
id: sku.id, // skuId,下单时后端需要
|
|
||||||
price: sku.price, // 价格(单位分)
|
|
||||||
stock_num: sku.quantity // 当前 sku 组合对应的库存
|
|
||||||
};
|
};
|
||||||
for (let j = 0; j < sku.attrs.length; j++) {
|
},
|
||||||
let attr = sku.attrs[j];
|
|
||||||
skuVO['attr_' + attr.attrId] =attr.attrValueId;
|
onClickCart() {
|
||||||
}
|
this.$router.push('/cart');
|
||||||
vanSku.list.push(skuVO);
|
},
|
||||||
// tree 规格
|
sorry() {
|
||||||
for (let j = 0; j < sku.attrs.length; j++) {
|
Toast('暂无后续逻辑~');
|
||||||
let attr = sku.attrs[j];
|
},
|
||||||
let attrVO;
|
showPromotion() {
|
||||||
for (let k = 0; k < vanSku.tree.length; k++) {
|
this.show = true;
|
||||||
if (attr.attrName === vanSku.tree[k].k) {
|
},
|
||||||
attrVO = vanSku.tree[k];
|
showSku() { // 展示 sku 选择
|
||||||
break;
|
this.showBase = true;
|
||||||
|
},
|
||||||
|
onClickShowTag() {
|
||||||
|
this.showTag = true;
|
||||||
|
},
|
||||||
|
onBuyClicked(data) {
|
||||||
|
const { selectedNum, goodsId } = data;
|
||||||
|
console.log(data);
|
||||||
|
// this.$toast(JSON.stringify(data));
|
||||||
|
this.$router.push({
|
||||||
|
path:'/order',
|
||||||
|
query:{
|
||||||
|
skuId: goodsId,
|
||||||
|
quantity: selectedNum,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onAddCartClicked(data) {
|
||||||
|
this.$toast(JSON.stringify(data));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
let id = this.$route.params.id; // 商品编号
|
||||||
|
let response = getProductSpuInfo(id);
|
||||||
|
response.then(data => {
|
||||||
|
// 设置 spu
|
||||||
|
this.spu = data;
|
||||||
|
// 初始化 vanSku
|
||||||
|
let vanSku = {
|
||||||
|
tree: [],
|
||||||
|
list: [],
|
||||||
|
};
|
||||||
|
for (let i = 0; i < data.skus.length; i++) {
|
||||||
|
let sku = data.skus[i];
|
||||||
|
// list 商品 sku 信息
|
||||||
|
let skuVO = {
|
||||||
|
id: sku.id, // skuId,下单时后端需要
|
||||||
|
price: sku.price, // 价格(单位分)
|
||||||
|
stock_num: sku.quantity // 当前 sku 组合对应的库存
|
||||||
|
};
|
||||||
|
for (let j = 0; j < sku.attrs.length; j++) {
|
||||||
|
let attr = sku.attrs[j];
|
||||||
|
skuVO['attr_' + attr.attrId] = attr.attrValueId;
|
||||||
|
}
|
||||||
|
vanSku.list.push(skuVO);
|
||||||
|
// tree 规格
|
||||||
|
for (let j = 0; j < sku.attrs.length; j++) {
|
||||||
|
let attr = sku.attrs[j];
|
||||||
|
let attrVO;
|
||||||
|
for (let k = 0; k < vanSku.tree.length; k++) {
|
||||||
|
if (attr.attrName === vanSku.tree[k].k) {
|
||||||
|
attrVO = vanSku.tree[k];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!attrVO) { // 未找到,则初始化该规格
|
||||||
if (!attrVO) { // 未找到,则初始化该规格
|
attrVO = {
|
||||||
attrVO = {
|
k: attr.attrName, // skuKeyName:规格类目名称
|
||||||
k: attr.attrName, // skuKeyName:规格类目名称
|
v: [],
|
||||||
v: [],
|
k_s: 'attr_' + attr.attrId,
|
||||||
k_s: 'attr_' + attr.attrId,
|
};
|
||||||
};
|
vanSku.tree.push(attrVO);
|
||||||
vanSku.tree.push(attrVO);
|
|
||||||
}
|
|
||||||
let attrValueFound = false; // 如果规格值已经存在,则不再添加
|
|
||||||
for (let k = 0; k < attrVO.v.length; k++) {
|
|
||||||
if (attr.attrValueId === attrVO.v[k].id) {
|
|
||||||
attrValueFound = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
let attrValueFound = false; // 如果规格值已经存在,则不再添加
|
||||||
|
for (let k = 0; k < attrVO.v.length; k++) {
|
||||||
|
if (attr.attrValueId === attrVO.v[k].id) {
|
||||||
|
attrValueFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!attrValueFound) {
|
||||||
|
attrVO.v.push({
|
||||||
|
id: attr.attrValueId, // skuValueId:规格值 id
|
||||||
|
name: attr.attrValueName, // skuValueName:规格值名称
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 初始化 attrValueMap
|
||||||
|
this.attrValueMap.set(attr.attrValueId, attr.attrValueName);
|
||||||
}
|
}
|
||||||
if (!attrValueFound) {
|
|
||||||
attrVO.v.push({
|
|
||||||
id: attr.attrValueId, // skuValueId:规格值 id
|
|
||||||
name: attr.attrValueName, // skuValueName:规格值名称
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 初始化 attrValueMap
|
|
||||||
this.attrValueMap.set(attr.attrValueId, attr.attrValueName);
|
|
||||||
}
|
}
|
||||||
}
|
// debugger;
|
||||||
// debugger;
|
this.vanSku = vanSku;
|
||||||
this.vanSku = vanSku;
|
// 初始化
|
||||||
// 初始化
|
// TODO 芋艿,需要处理下第一个有效的 sku
|
||||||
// TODO 芋艿,需要处理下第一个有效的 sku
|
this.initialSku = vanSku.list[0];
|
||||||
this.initialSku = vanSku.list[0];
|
this.initialSku.quantity = 1;
|
||||||
this.initialSku.quantity = 1;
|
});
|
||||||
});
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.goods {
|
.goods {
|
||||||
padding-bottom: 50px;
|
padding-bottom: 50px;
|
||||||
&-swipe {
|
|
||||||
img {
|
&-swipe {
|
||||||
width: 7.5rem;
|
img {
|
||||||
height: 7.5rem;
|
width: 7.5rem;
|
||||||
display: block;
|
height: 7.5rem;
|
||||||
}
|
display: block;
|
||||||
}
|
|
||||||
&-tag{
|
|
||||||
font-size: 12px;
|
|
||||||
border-top: 1px solid #e5e5e5;
|
|
||||||
span{
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
i{
|
|
||||||
color: red;
|
|
||||||
margin-right: 3px;
|
|
||||||
}
|
|
||||||
img{
|
|
||||||
width: 12px;
|
|
||||||
margin-right: 3px;
|
|
||||||
margin-top: 6px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&-title {
|
|
||||||
line-height: 18px;
|
&-tag {
|
||||||
padding-top: 10px;
|
font-size: 12px;
|
||||||
margin-bottom: 6px;
|
border-top: 1px solid #e5e5e5;
|
||||||
font-size: 14px;
|
|
||||||
color: #333;
|
span {
|
||||||
font-weight: 700;
|
margin-right: 10px;
|
||||||
border-top: 1px solid #f0f0f0;
|
}
|
||||||
}
|
|
||||||
&-subtit{
|
i {
|
||||||
|
color: red;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 12px;
|
||||||
|
margin-right: 3px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
line-height: 18px;
|
||||||
|
padding-top: 10px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 700;
|
||||||
|
border-top: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-subtit {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #333;
|
||||||
|
line-height: 21px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-price {
|
||||||
|
color: #f44;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-market-price {
|
||||||
|
text-decoration: line-through;
|
||||||
|
margin-left: 8px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #333;
|
|
||||||
line-height: 21px;
|
|
||||||
}
|
|
||||||
&-price {
|
|
||||||
color: #f44;font-size: 20px;
|
|
||||||
}
|
|
||||||
&-market-price {
|
|
||||||
text-decoration: line-through;
|
|
||||||
margin-left: 8px;
|
|
||||||
font-size: 13px;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
&-cell-group {
|
|
||||||
margin: 15px 0;
|
|
||||||
.van-cell__value {
|
|
||||||
color: #999;
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
&-info-title{
|
&-cell-group {
|
||||||
height: 44px;line-height: 44px;text-align: center;font-size: 14px;font-weight: 700;margin: 10px;border-top: 1px solid #e5e5e5;
|
margin: 15px 0;
|
||||||
}
|
|
||||||
&-info p{
|
.van-cell__value {
|
||||||
margin: 0;
|
color: #999;
|
||||||
padding: 0;
|
}
|
||||||
margin-block-end: 0;
|
}
|
||||||
margin-block-start: 0;
|
|
||||||
display: grid;
|
&-info-title {
|
||||||
}
|
height: 44px;
|
||||||
&-info img{
|
line-height: 44px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 10px;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-info p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin-block-end: 0;
|
||||||
|
margin-block-start: 0;
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-info img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
</style>
|
||||||
</style>
|
|
||||||
|
35
mobile-web/src/page/shipping/order-success.vue
Normal file
35
mobile-web/src/page/shipping/order-success.vue
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<template>
|
||||||
|
<div class="order-success">
|
||||||
|
<headerNav title="提交成功"/>
|
||||||
|
|
||||||
|
<sapn>TODO 支付成功</sapn>
|
||||||
|
|
||||||
|
<router-link :to="'/user/order'">
|
||||||
|
<van-button size="small" type="danger">订单列表</van-button>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import {createOrder} from '../../api/order';
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.order-success {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="order">
|
<div class="order">
|
||||||
<headerNav title="确认订单"/>
|
<headerNav title="确认订单"/>
|
||||||
<van-cell
|
<van-cell
|
||||||
center
|
center
|
||||||
:border="false"
|
:border="false"
|
||||||
class="contact-card"
|
class="contact-card"
|
||||||
@ -13,12 +13,12 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<strong>张三 138****6520</strong>
|
<strong>张三 138****6520</strong>
|
||||||
<div>广东省深圳市南山区科技园 </div>
|
<div>广东省深圳市南山区科技园</div>
|
||||||
</template>
|
</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
<div style="height:15px;"></div>
|
<div style="height:15px;"></div>
|
||||||
<div class="card" v-for="(product,i) in products" :key="i">
|
<div class="card" v-for="(product,i) in products" :key="i">
|
||||||
<product-card :product='product' />
|
<product-card :product='product'/>
|
||||||
</div>
|
</div>
|
||||||
<div style="height:15px;"></div>
|
<div style="height:15px;"></div>
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
@ -32,15 +32,15 @@
|
|||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
<div style="height:15px;"></div>
|
<div style="height:15px;"></div>
|
||||||
<van-cell-group class="total">
|
<van-cell-group class="total">
|
||||||
<van-cell title="优惠券" is-link value="抵扣¥5.00" />
|
<van-cell title="优惠券" is-link value="抵扣¥5.00"/>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div style="height:15px;"></div>
|
<div style="height:15px;"></div>
|
||||||
<van-cell-group class="total">
|
<van-cell-group class="total">
|
||||||
<van-cell title="商品总额" value="9.99" />
|
<van-cell title="商品总额" value="9.99"/>
|
||||||
<van-cell title="运费" value="+ 0.00" />
|
<van-cell title="运费" value="+ 0.00"/>
|
||||||
<van-cell title="折扣" value="- 5.00" />
|
<van-cell title="折扣" value="- 5.00"/>
|
||||||
<van-cell title="实付金额" value="4.99" style="font-weight: 700;" />
|
<van-cell title="实付金额" value="4.99" style="font-weight: 700;"/>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div style="height:50px;"></div>
|
<div style="height:50px;"></div>
|
||||||
@ -55,130 +55,155 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
|
||||||
data() {
|
import {createOrder} from '../../api/order';
|
||||||
return {
|
|
||||||
type: "add1",
|
export default {
|
||||||
products: [
|
data() {
|
||||||
{
|
return {
|
||||||
imageURL:
|
type: "add1",
|
||||||
"https://img10.360buyimg.com/mobilecms/s88x88_jfs/t17572/12/840082281/351445/e1828c58/5aab8dbbNedb77d88.jpg",
|
products: [
|
||||||
title: "良品铺子 肉肉聚汇猪肉脯 猪蹄卤 辣味小吃520g",
|
{
|
||||||
desc: "0.670kg/件,肉肉聚汇520g",
|
imageURL:
|
||||||
price: "59.80",
|
"https://img10.360buyimg.com/mobilecms/s88x88_jfs/t17572/12/840082281/351445/e1828c58/5aab8dbbNedb77d88.jpg",
|
||||||
quantity: 2
|
title: "良品铺子 肉肉聚汇猪肉脯 猪蹄卤 辣味小吃520g",
|
||||||
},
|
desc: "0.670kg/件,肉肉聚汇520g",
|
||||||
{
|
price: "59.80",
|
||||||
imageURL:
|
quantity: 2
|
||||||
"https://img10.360buyimg.com/mobilecms/s88x88_jfs/t22720/128/1410375403/319576/8dbd859f/5b5e69b3Nf4f0e9e7.jpg",
|
},
|
||||||
title: "元朗 鸡蛋卷 饼干糕点 中秋礼盒 广东特产680g",
|
{
|
||||||
desc: "1.320kg/件",
|
imageURL:
|
||||||
price: "65.80",
|
"https://img10.360buyimg.com/mobilecms/s88x88_jfs/t22720/128/1410375403/319576/8dbd859f/5b5e69b3Nf4f0e9e7.jpg",
|
||||||
quantity: 1,
|
title: "元朗 鸡蛋卷 饼干糕点 中秋礼盒 广东特产680g",
|
||||||
gift: [
|
desc: "1.320kg/件",
|
||||||
{
|
price: "65.80",
|
||||||
title: "星巴克(Starbucks)星冰乐小熊吊饰星巴克(Starbucks)星冰乐小熊吊饰",
|
quantity: 1,
|
||||||
quantity: 2
|
gift: [
|
||||||
},
|
{
|
||||||
{
|
title: "星巴克(Starbucks)星冰乐小熊吊饰星巴克(Starbucks)星冰乐小熊吊饰",
|
||||||
title: "星巴克(Starbucks)星冰乐小熊吊饰星巴克(Starbucks)星冰乐小熊吊饰",
|
quantity: 2
|
||||||
quantity: 1
|
},
|
||||||
}
|
{
|
||||||
]
|
title: "星巴克(Starbucks)星冰乐小熊吊饰星巴克(Starbucks)星冰乐小熊吊饰",
|
||||||
},
|
quantity: 1
|
||||||
{
|
}
|
||||||
imageURL:
|
]
|
||||||
"https://img10.360buyimg.com/mobilecms/s88x88_jfs/t17572/12/840082281/351445/e1828c58/5aab8dbbNedb77d88.jpg",
|
},
|
||||||
title: "良品铺子 肉肉聚汇猪肉脯 猪蹄卤 辣味小吃520g",
|
{
|
||||||
desc: "0.670kg/件,肉肉聚汇520g",
|
imageURL:
|
||||||
price: "59.80",
|
"https://img10.360buyimg.com/mobilecms/s88x88_jfs/t17572/12/840082281/351445/e1828c58/5aab8dbbNedb77d88.jpg",
|
||||||
quantity: 2
|
title: "良品铺子 肉肉聚汇猪肉脯 猪蹄卤 辣味小吃520g",
|
||||||
},
|
desc: "0.670kg/件,肉肉聚汇520g",
|
||||||
]
|
price: "59.80",
|
||||||
};
|
quantity: 2
|
||||||
},
|
},
|
||||||
methods: {
|
]
|
||||||
onSubmit() {
|
};
|
||||||
this.$toast("点击按钮");
|
|
||||||
},
|
},
|
||||||
},
|
methods: {
|
||||||
activated(){
|
onSubmit() {
|
||||||
//根据key名获取传递回来的参数,data就是map
|
this.$toast("点击按钮");
|
||||||
this.$on('selectAddress', function(data){
|
const { skuId, quantity } = this.$route.query;
|
||||||
|
const userAddressId = 1;
|
||||||
|
const remark = '';
|
||||||
|
|
||||||
|
const orderItems = [{
|
||||||
|
skuId,
|
||||||
|
quantity,
|
||||||
|
}];
|
||||||
|
|
||||||
|
createOrder({
|
||||||
|
orderItems,
|
||||||
|
userAddressId,
|
||||||
|
remark,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
activated() {
|
||||||
|
//根据key名获取传递回来的参数,data就是map
|
||||||
|
this.$on('selectAddress', function (data) {
|
||||||
//赋值给首页的附近医院数据模型
|
//赋值给首页的附近医院数据模型
|
||||||
console.log(1);
|
console.log(1);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
.order {
|
.order {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
background: #f7f7f7;
|
background: #f7f7f7;
|
||||||
.contact-card::before {
|
|
||||||
content: "";
|
.contact-card::before {
|
||||||
left: 0;
|
content: "";
|
||||||
right: 0;
|
left: 0;
|
||||||
bottom: 0;
|
right: 0;
|
||||||
height: 2px;
|
bottom: 0;
|
||||||
position: absolute;
|
height: 2px;
|
||||||
background: -webkit-repeating-linear-gradient(
|
position: absolute;
|
||||||
135deg,
|
background: -webkit-repeating-linear-gradient(
|
||||||
#ff6c6c 0,
|
135deg,
|
||||||
#ff6c6c 20%,
|
#ff6c6c 0,
|
||||||
transparent 0,
|
#ff6c6c 20%,
|
||||||
transparent 25%,
|
transparent 0,
|
||||||
#3283fa 0,
|
transparent 25%,
|
||||||
#3283fa 45%,
|
#3283fa 0,
|
||||||
transparent 0,
|
#3283fa 45%,
|
||||||
transparent 50%
|
transparent 0,
|
||||||
);
|
transparent 50%
|
||||||
background: repeating-linear-gradient(
|
);
|
||||||
-45deg,
|
background: repeating-linear-gradient(
|
||||||
#ff6c6c 0,
|
-45deg,
|
||||||
#ff6c6c 20%,
|
#ff6c6c 0,
|
||||||
transparent 0,
|
#ff6c6c 20%,
|
||||||
transparent 25%,
|
transparent 0,
|
||||||
#3283fa 0,
|
transparent 25%,
|
||||||
#3283fa 45%,
|
#3283fa 0,
|
||||||
transparent 0,
|
#3283fa 45%,
|
||||||
transparent 50%
|
transparent 0,
|
||||||
);
|
transparent 50%
|
||||||
background-size: 80px;
|
);
|
||||||
}
|
background-size: 80px;
|
||||||
.total {
|
|
||||||
.van-cell__value {
|
|
||||||
color: red;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
.total {
|
||||||
.van-submit-bar__bar {
|
.van-cell__value {
|
||||||
border-top: 1px solid #f7f7f7;
|
color: red;
|
||||||
}
|
}
|
||||||
.additional {
|
|
||||||
.van-cell {
|
|
||||||
padding: 0 15px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
.van-cell__title {
|
|
||||||
flex: 11;
|
.van-submit-bar__bar {
|
||||||
overflow: hidden;
|
border-top: 1px solid #f7f7f7;
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
.van-tag {
|
|
||||||
line-height: 12px;
|
.additional {
|
||||||
margin-right: 5px;
|
.van-cell {
|
||||||
}
|
padding: 0 15px;
|
||||||
|
font-size: 12px;
|
||||||
.price {
|
}
|
||||||
color: #e93b3d;
|
|
||||||
font-size: 10px;
|
.van-cell__title {
|
||||||
span {
|
flex: 11;
|
||||||
font-size: 16px;
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.van-tag {
|
||||||
|
line-height: 12px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.price {
|
||||||
|
color: #e93b3d;
|
||||||
|
font-size: 10px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,176 +1,249 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<headerNav title="我的订单"/>
|
<headerNav title="我的订单"/>
|
||||||
<van-tabs v-model="active">
|
<van-tabs v-model="active" @change="onTabChange">
|
||||||
<van-tab title="全部">
|
<van-tab title="全部"></van-tab>
|
||||||
|
<van-tab title="待付款"></van-tab>
|
||||||
<div v-for="(item,index) in list" :key="index">
|
<van-tab title="待收货"></van-tab>
|
||||||
<van-cell-group class="order-item" >
|
<van-tab title="已完成"></van-tab>
|
||||||
<van-panel :title="'订单:'+item.ordercode" :status="item.state" >
|
<van-tab title="已取消"></van-tab>
|
||||||
<div slot="header">
|
|
||||||
<van-cell class="title" :title="'订单:'+item.ordercode" :value="item.state" :to="'/user/order/info/'+item.orderid"/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<router-link :to="'/user/order/info/'+item.orderid">
|
|
||||||
<div v-if="item.products.length==1" v-for="(product,i) in item.products" :key="i">
|
|
||||||
<product-card :product='product' />
|
|
||||||
</div>
|
|
||||||
<div v-if="item.products.length>1" class="more" >
|
|
||||||
<div class="item" v-for="(product,i) in item.products" :key="i">
|
|
||||||
<div >
|
|
||||||
<img :src="product.imageURL"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</router-link>
|
|
||||||
</div>
|
|
||||||
<div slot="footer">
|
|
||||||
<span class="total">总价:¥8154898.89</span>
|
|
||||||
<van-button size="small">确认收货</van-button>
|
|
||||||
<van-button size="small" type="danger">支付</van-button>
|
|
||||||
</div>
|
|
||||||
</van-panel>
|
|
||||||
</van-cell-group>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</van-tab>
|
|
||||||
<van-tab title="待付款">内容 2</van-tab>
|
|
||||||
<van-tab title="待收货">内容 3</van-tab>
|
|
||||||
<van-tab title="已完成">内容 4</van-tab>
|
|
||||||
<van-tab title="已取消">内容 5</van-tab>
|
|
||||||
</van-tabs>
|
</van-tabs>
|
||||||
</div>
|
|
||||||
|
<div v-for="(item,index) in list" :key="index">
|
||||||
|
<van-cell-group class="order-item">
|
||||||
|
<van-panel :title="'订单:'+item.ordercode" :status="item.state">
|
||||||
|
<div slot="header">
|
||||||
|
<van-cell class="title" :title="'订单:'+item.ordercode" :value="item.state"
|
||||||
|
:to="'/user/order/info/'+item.orderid"/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<router-link :to="'/user/order/info/'+item.orderid">
|
||||||
|
<div v-if="item.products.length==1" v-for="(product,i) in item.products" :key="i">
|
||||||
|
<product-card :product='product'/>
|
||||||
|
</div>
|
||||||
|
<div v-if="item.products.length > 0" class="more">
|
||||||
|
<div class="item" v-for="(product,i) in item.products" :key="i">
|
||||||
|
<div>
|
||||||
|
<img :src="product.imageURL"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
<div slot="footer">
|
||||||
|
<span class="total">总价:{{item.payAmount / 100}} 元</span>
|
||||||
|
<van-button size="small">确认收货</van-button>
|
||||||
|
<van-button size="small" type="danger">支付</van-button>
|
||||||
|
</div>
|
||||||
|
</van-panel>
|
||||||
|
</van-cell-group>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
|
||||||
components:{
|
import {getOrderPage} from '../../../api/order';
|
||||||
},
|
|
||||||
data(){
|
export default {
|
||||||
return{
|
components: {},
|
||||||
active:0,
|
data() {
|
||||||
|
return {
|
||||||
list:[
|
active: 0,
|
||||||
{
|
|
||||||
orderid:1,
|
list: [
|
||||||
ordercode:'4511248234235',
|
{
|
||||||
state:'待付款',
|
orderid: 1,
|
||||||
products:[
|
ordercode: '4511248234235',
|
||||||
{
|
state: '待付款',
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
products: [
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
{
|
||||||
price:'499',
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
quantity:2
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
},
|
price: '499',
|
||||||
{
|
quantity: 2
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
},
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
{
|
||||||
price:'499',
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
quantity:1
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
},
|
price: '499',
|
||||||
{
|
quantity: 1
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
},
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
{
|
||||||
price:'499',
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
quantity:2
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
},
|
price: '499',
|
||||||
{
|
quantity: 2
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
},
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
{
|
||||||
price:'499',
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
quantity:2
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
},
|
price: '499',
|
||||||
{
|
quantity: 2
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
},
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
{
|
||||||
price:'499',
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
quantity:2
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
},
|
price: '499',
|
||||||
]
|
quantity: 2
|
||||||
},
|
},
|
||||||
{
|
|
||||||
orderid:2,
|
|
||||||
ordercode:'4511248234235',
|
|
||||||
state:'待收货',
|
|
||||||
products:[
|
|
||||||
{
|
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
|
||||||
price:'499',
|
|
||||||
quantity:2
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
orderid:3,
|
|
||||||
ordercode:'4511248234235',
|
|
||||||
state:'已完成',
|
|
||||||
products:[
|
|
||||||
{
|
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
|
||||||
price:'499',
|
|
||||||
quantity:2
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
orderid:4,
|
|
||||||
ordercode:'4511248234235',
|
|
||||||
state:'已取消',
|
|
||||||
products:[
|
|
||||||
{
|
|
||||||
imageURL:'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
|
||||||
title:'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
|
||||||
price:'499',
|
|
||||||
quantity:2
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
}
|
{
|
||||||
}
|
orderid: 2,
|
||||||
|
ordercode: '4511248234235',
|
||||||
|
state: '待收货',
|
||||||
|
products: [
|
||||||
|
{
|
||||||
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
|
price: '499',
|
||||||
|
quantity: 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
orderid: 3,
|
||||||
|
ordercode: '4511248234235',
|
||||||
|
state: '已完成',
|
||||||
|
products: [
|
||||||
|
{
|
||||||
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
|
price: '499',
|
||||||
|
quantity: 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
orderid: 4,
|
||||||
|
ordercode: '4511248234235',
|
||||||
|
state: '已取消',
|
||||||
|
products: [
|
||||||
|
{
|
||||||
|
imageURL: 'https://pop.nosdn.127.net/19e33c9b-6c22-4a4b-96da-1cb7afb32712',
|
||||||
|
title: 'BEYOND博洋家纺 床上套件 秋冬保暖纯棉床单被套 双人被罩 磨毛全棉印花床品四件套',
|
||||||
|
price: '499',
|
||||||
|
quantity: 2
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onTabChange(index) {
|
||||||
|
console.log('onTabChange', index)
|
||||||
|
|
||||||
|
// status 和 tab index 对应的关系
|
||||||
|
const statusArray = [null, 1, 3, 4, 5];
|
||||||
|
// if (index === 0) {
|
||||||
|
// // 全部
|
||||||
|
// } else if (index === 1) {
|
||||||
|
// // 待付款 1
|
||||||
|
// } else if (index === 2) {
|
||||||
|
// // 待收货 3
|
||||||
|
// } else if (index === 3) {
|
||||||
|
// // 已完成 4
|
||||||
|
// } else if (index === 4) {
|
||||||
|
// // 取消 5
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
this.queryOrderPage({
|
||||||
|
status: statusArray[index],
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
queryOrderPage(params) {
|
||||||
|
getOrderPage({
|
||||||
|
pageNo: 0,
|
||||||
|
pageSize: 10,
|
||||||
|
...params,
|
||||||
|
}).then(data => {
|
||||||
|
const {orders} = data;
|
||||||
|
const list = orders.map(order => {
|
||||||
|
const {orderItems} = order;
|
||||||
|
const products = orderItems.map(order => {
|
||||||
|
return {
|
||||||
|
imageURL: order.skuImage,
|
||||||
|
title: order.skuName,
|
||||||
|
price: order.price,
|
||||||
|
quantity: order.quantity,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
orderid: order.id,
|
||||||
|
ordercode: order.orderNo,
|
||||||
|
state: `${order.status}`,
|
||||||
|
products,
|
||||||
|
payAmount: order.payAmount,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
this.list = list;
|
||||||
|
// console.log('list', list)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.queryOrderPage()
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
|
||||||
.order-item{
|
.order-item {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
.title{
|
|
||||||
border-bottom: 1px solid #e5e5e5;
|
|
||||||
|
|
||||||
.van-cell__title{
|
.title {
|
||||||
flex: 2;
|
border-bottom: 1px solid #e5e5e5;
|
||||||
}
|
|
||||||
.van-cell__value{
|
.van-cell__title {
|
||||||
color: red;
|
flex: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.van-cell__value {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.van-panel__footer {
|
.van-panel__footer {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
border-bottom: 1px solid #e5e5e5;
|
border-bottom: 1px solid #e5e5e5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.van-button {
|
.van-button {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
.total{
|
|
||||||
position: absolute;
|
.total {
|
||||||
top: 17px;
|
position: absolute;
|
||||||
left: 15px;
|
top: 17px;
|
||||||
font-size: 13px;
|
left: 15px;
|
||||||
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
.more{
|
|
||||||
overflow-x: scroll;white-space: nowrap; -webkit-overflow-scrolling: touch; margin: 5px 0 5px 15px;
|
.more {
|
||||||
.item{
|
overflow-x: scroll;
|
||||||
width: 90px; height:90px; margin-right: 10px;display: inline-block;
|
white-space: nowrap;
|
||||||
img{
|
-webkit-overflow-scrolling: touch;
|
||||||
width: 100%;
|
margin: 5px 0 5px 15px;
|
||||||
}
|
|
||||||
|
.item {
|
||||||
|
width: 90px;
|
||||||
|
height: 90px;
|
||||||
|
margin-right: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -109,29 +109,13 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source> <!-- or higher, depending on your project -->
|
|
||||||
<target>1.8</target> <!-- or higher, depending on your project -->
|
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>org.mapstruct</groupId>
|
|
||||||
<artifactId>mapstruct-processor</artifactId>
|
|
||||||
<version>${org.mapstruct.version}</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- 打包 -->
|
<!-- 打包 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
|
||||||
<fork>true</fork>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -33,4 +33,12 @@ public class MVCConfiguration implements WebMvcConfigurer {
|
|||||||
registry.addResourceHandler("webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
registry.addResourceHandler("webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 芋艿,允许跨域
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedHeaders("*")
|
||||||
|
.allowedMethods("*")
|
||||||
|
.allowedOrigins("*");
|
||||||
|
}
|
||||||
}
|
}
|
@ -8,10 +8,10 @@ import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
|
|||||||
import cn.iocoder.mall.order.api.dto.*;
|
import cn.iocoder.mall.order.api.dto.*;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderDeliveryConvert;
|
import cn.iocoder.mall.order.application.convert.OrderDeliveryConvert;
|
||||||
import cn.iocoder.mall.order.application.po.OrderDeliverPO;
|
import cn.iocoder.mall.order.application.po.admin.OrderDeliverPO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderItemUpdatePO;
|
import cn.iocoder.mall.order.application.po.admin.OrderItemUpdatePO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderLogisticsPO;
|
import cn.iocoder.mall.order.application.po.admin.OrderLogisticsPO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderPageQueryPO;
|
import cn.iocoder.mall.order.application.po.admin.OrderPageQueryPO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -37,7 +37,7 @@ public class AdminsOrderController {
|
|||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@ApiOperation("订单列表")
|
@ApiOperation("订单列表")
|
||||||
public CommonResult<OrderPageBO> getOrderPage(@Validated OrderPageQueryPO orderPageQueryVO) {
|
public CommonResult<OrderPageBO> getOrderPage(@Validated OrderPageQueryPO orderPageQueryVO) {
|
||||||
OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convertPageBO(orderPageQueryVO);
|
OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convert(orderPageQueryVO);
|
||||||
return orderService.getOrderPage(orderQueryDTO);
|
return orderService.getOrderPage(orderQueryDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,14 +86,14 @@ public class AdminsOrderController {
|
|||||||
@PutMapping("order_item/update")
|
@PutMapping("order_item/update")
|
||||||
@ApiOperation("更新-订单item")
|
@ApiOperation("更新-订单item")
|
||||||
public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdatePO orderItemUpdateVO) {
|
public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdatePO orderItemUpdateVO) {
|
||||||
OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderItemUpdateVO);
|
OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convert(orderItemUpdateVO);
|
||||||
return orderService.updateOrderItem(dto);
|
return orderService.updateOrderItem(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("logistics/update")
|
@PutMapping("logistics/update")
|
||||||
@ApiOperation("更新-订单物流")
|
@ApiOperation("更新-订单物流")
|
||||||
public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsPO orderLogisticsVO) {
|
public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsPO orderLogisticsVO) {
|
||||||
OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderLogisticsVO);
|
OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convert(orderLogisticsVO);
|
||||||
return orderService.updateLogistics(dto);
|
return orderService.updateLogistics(dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,18 @@
|
|||||||
package cn.iocoder.mall.order.application.controller.users;
|
package cn.iocoder.mall.order.application.controller.users;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import cn.iocoder.mall.order.api.OrderService;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderCreateBO;
|
||||||
|
import cn.iocoder.mall.order.api.bo.OrderPageBO;
|
||||||
|
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||||
|
import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
|
||||||
|
import cn.iocoder.mall.order.api.dto.OrderUserPageDTO;
|
||||||
|
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
||||||
|
import cn.iocoder.mall.order.application.po.user.OrderCreatePO;
|
||||||
|
import cn.iocoder.mall.user.sdk.context.UserSecurityContextHolder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单API(users)
|
* 订单API(users)
|
||||||
@ -12,4 +23,22 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("users/order")
|
@RequestMapping("users/order")
|
||||||
public class UsersOrderController {
|
public class UsersOrderController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderService orderService;
|
||||||
|
|
||||||
|
@GetMapping("order_page")
|
||||||
|
public CommonResult<OrderPageBO> getOrderPage(@Validated OrderQueryDTO orderQueryDTO) {
|
||||||
|
Integer userId = UserSecurityContextHolder.getContext().getUserId();
|
||||||
|
orderQueryDTO.setUserId(userId);
|
||||||
|
return orderService.getOrderPage(orderQueryDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("create_order")
|
||||||
|
public CommonResult<OrderCreateBO> createOrder(@RequestBody @Validated OrderCreatePO orderCreatePO) {
|
||||||
|
Integer userId = UserSecurityContextHolder.getContext().getUserId();
|
||||||
|
OrderCreateDTO orderCreateDTO = OrderConvertAPP.INSTANCE.convert(orderCreatePO);
|
||||||
|
orderCreateDTO.setUserId(1);
|
||||||
|
return orderService.createOrder(orderCreateDTO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package cn.iocoder.mall.order.application.convert;
|
package cn.iocoder.mall.order.application.convert;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
|
import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderItemUpdatePO;
|
import cn.iocoder.mall.order.application.po.admin.OrderItemUpdatePO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderPageQueryPO;
|
import cn.iocoder.mall.order.application.po.admin.OrderLogisticsPO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderLogisticsPO;
|
import cn.iocoder.mall.order.application.po.admin.OrderPageQueryPO;
|
||||||
|
import cn.iocoder.mall.order.application.po.user.OrderCreatePO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -24,11 +26,14 @@ public interface OrderConvertAPP {
|
|||||||
OrderConvertAPP INSTANCE = Mappers.getMapper(OrderConvertAPP.class);
|
OrderConvertAPP INSTANCE = Mappers.getMapper(OrderConvertAPP.class);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderQueryDTO convertPageBO(OrderPageQueryPO orderPageQueryVO);
|
OrderQueryDTO convert(OrderPageQueryPO orderPageQueryVO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderLogisticsUpdateDTO convertPageBO(OrderLogisticsPO orderLogisticsVO);
|
OrderLogisticsUpdateDTO convert(OrderLogisticsPO orderLogisticsVO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderItemUpdateDTO convertPageBO(OrderItemUpdatePO orderItemUpdateVO);
|
OrderItemUpdateDTO convert(OrderItemUpdatePO orderItemUpdateVO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OrderCreateDTO convert(OrderCreatePO orderCreatePO);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.iocoder.mall.order.application.convert;
|
package cn.iocoder.mall.order.application.convert;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
||||||
import cn.iocoder.mall.order.application.po.OrderDeliverPO;
|
import cn.iocoder.mall.order.application.po.admin.OrderDeliverPO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.mall.order.application.po;
|
package cn.iocoder.mall.order.application.po.admin;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.mall.order.application.po;
|
package cn.iocoder.mall.order.application.po.admin;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.mall.order.application.po;
|
package cn.iocoder.mall.order.application.po.admin;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.mall.order.application.po;
|
package cn.iocoder.mall.order.application.po.admin;
|
||||||
|
|
||||||
import cn.iocoder.mall.order.api.bo.OrderBO;
|
import cn.iocoder.mall.order.api.bo.OrderBO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
@ -1,4 +1,4 @@
|
|||||||
package cn.iocoder.mall.order.application.po;
|
package cn.iocoder.mall.order.application.po.admin;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.mall.order.application.po.user;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.order.api.dto.OrderCreateItemDTO;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单创建
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-03-16 14:42
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OrderCreatePO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收件手机号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户地址id不能为空!")
|
||||||
|
private Integer userAddressId;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// order item
|
||||||
|
|
||||||
|
@NotNull()
|
||||||
|
@Size(max = 1000, min = 1, message = "用户订单中没有商品!")
|
||||||
|
private List<OrderCreateItemDTO> orderItems;
|
||||||
|
|
||||||
|
}
|
@ -11,10 +11,6 @@
|
|||||||
|
|
||||||
<artifactId>order-service-api</artifactId>
|
<artifactId>order-service-api</artifactId>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<org.projectlombok.version>1.16.14</org.projectlombok.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
@ -26,10 +22,17 @@
|
|||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-jdk8</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>${org.projectlombok.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -44,11 +44,10 @@ public interface OrderService {
|
|||||||
/**
|
/**
|
||||||
* 订单 - 创建
|
* 订单 - 创建
|
||||||
*
|
*
|
||||||
* @param userId
|
|
||||||
* @param orderCreateDTO
|
* @param orderCreateDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CommonResult<OrderCreateBO> createOrder(Integer userId, OrderCreateDTO orderCreateDTO);
|
CommonResult<OrderCreateBO> createOrder(OrderCreateDTO orderCreateDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单item - 更新
|
* 订单item - 更新
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package cn.iocoder.mall.order.api.bo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单支付信息返回
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-08 19:39
|
||||||
|
*/
|
||||||
|
public class OrderPayBO implements Serializable {
|
||||||
|
}
|
@ -17,9 +17,16 @@ public enum OrderErrorCodeEnum {
|
|||||||
ORDER_PAY_AMOUNT_NOT_NEGATIVE(1008000003, "支付金额不能为负数!"),
|
ORDER_PAY_AMOUNT_NOT_NEGATIVE(1008000003, "支付金额不能为负数!"),
|
||||||
ORDER_STATUS_NOT_CANCEL(1008000004, "订单状态不能取消!"),
|
ORDER_STATUS_NOT_CANCEL(1008000004, "订单状态不能取消!"),
|
||||||
ORDER_DELIVERY_INCORRECT_DATA(1008000005, "订单发货数据不正确!"),
|
ORDER_DELIVERY_INCORRECT_DATA(1008000005, "订单发货数据不正确!"),
|
||||||
|
ORDER_INSUFFICIENT_INVENTORY(1008000006, "库存不足!"),
|
||||||
|
ORDER_GOODS_AMOUNT_INCORRECT(1008000007, "商品金额非法!"),
|
||||||
|
ORDER_GET_GOODS_INFO_INCORRECT(1008000008, "获取额商品信息不正确!"),
|
||||||
|
ORDER_GET_USER_ADDRESS_FAIL(1008000009, "获取用户地址失败!"),
|
||||||
|
ORDER_GET_PAY_FAIL(1008000009, "调用pay失败!"),
|
||||||
|
|
||||||
// order item
|
// order item
|
||||||
ORDER_ITEM_ONLY_ONE(1008000004, "订单Item只有一个!"),
|
ORDER_ITEM_ONLY_ONE(1008000004, "订单Item只有一个!"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
@ -6,7 +6,7 @@ package cn.iocoder.mall.order.api.constant;
|
|||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-03-16 14:32
|
* @time 2019-03-16 14:32
|
||||||
*/
|
*/
|
||||||
public enum OrderPayStatusEnum {
|
public enum OrderPayStatus {
|
||||||
|
|
||||||
WAITING_PAYMENT(0, "等待支付"),
|
WAITING_PAYMENT(0, "等待支付"),
|
||||||
SUCCESSFUL_PAYMENT(1, "支付成功"),
|
SUCCESSFUL_PAYMENT(1, "支付成功"),
|
||||||
@ -19,7 +19,7 @@ public enum OrderPayStatusEnum {
|
|||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
OrderPayStatusEnum(int value, String name) {
|
OrderPayStatus(int value, String name) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.mall.order.api.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付 AppId
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-08 19:54
|
||||||
|
*/
|
||||||
|
public class PayAppId {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电商
|
||||||
|
*/
|
||||||
|
public static final String APP_ID_1024 = "1024";
|
||||||
|
|
||||||
|
}
|
@ -3,8 +3,6 @@ package cn.iocoder.mall.order.api.dto;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -23,34 +21,20 @@ public class OrderCreateDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
/**
|
/**
|
||||||
* 收件区域编号
|
* 用户地址
|
||||||
*/
|
*/
|
||||||
@NotNull
|
private Integer userAddressId;
|
||||||
private String areaNo;
|
|
||||||
/**
|
|
||||||
* 收件人名称
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 收件手机号
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
private String mobile;
|
|
||||||
/**
|
|
||||||
* 收件详细地址
|
|
||||||
*/
|
|
||||||
@NotNull
|
|
||||||
private String address;
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
/**
|
||||||
|
* ip信息
|
||||||
|
*/
|
||||||
|
private String ip;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// order item
|
/// order item
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Size(max = 1000, min = 1)
|
|
||||||
private List<OrderCreateItemDTO> orderItems;
|
private List<OrderCreateItemDTO> orderItems;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.mall.order.api.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单 page
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-08 17:50
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class OrderUserPageDTO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 用户 id
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
/**
|
||||||
|
* 付款时间(待发货)
|
||||||
|
*/
|
||||||
|
private Date startPaymentTime;
|
||||||
|
private Date endPaymentTime;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date startCreateTime;
|
||||||
|
private Date endCreateTime;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
}
|
@ -11,11 +11,6 @@
|
|||||||
|
|
||||||
<artifactId>order-service-impl</artifactId>
|
<artifactId>order-service-impl</artifactId>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<org.mapstruct.version>1.3.0.Final</org.mapstruct.version>
|
|
||||||
<org.projectlombok.version>1.16.14</org.projectlombok.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.mall</groupId>
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
@ -28,6 +23,19 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>pay-service-api</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>user-service-api</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>dubbo</artifactId>
|
<artifactId>dubbo</artifactId>
|
||||||
@ -47,43 +55,27 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mapstruct</groupId>
|
|
||||||
<artifactId>mapstruct</artifactId>
|
|
||||||
<version>${org.mapstruct.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>${org.projectlombok.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>27.0.1-jre</version>
|
<version>27.0.1-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>Pingplusplus</groupId>
|
<groupId>Pingplusplus</groupId>
|
||||||
<artifactId>pingpp-java</artifactId>
|
<artifactId>pingpp-java</artifactId>
|
||||||
<version>2.2.4</version>
|
<version>2.2.4</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.xuxueli</groupId>
|
<groupId>com.xuxueli</groupId>
|
||||||
<artifactId>xxl-job-core</artifactId>
|
<artifactId>xxl-job-core</artifactId>
|
||||||
<version>2.0.1</version>
|
<version>2.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.rocketmq</groupId>
|
<groupId>org.apache.rocketmq</groupId>
|
||||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||||
@ -108,6 +100,12 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.mall</groupId>
|
||||||
|
<artifactId>pay-service-api</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -116,23 +114,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.5.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source> <!-- or higher, depending on your project -->
|
|
||||||
<target>1.8</target> <!-- or higher, depending on your project -->
|
|
||||||
<annotationProcessorPaths>
|
|
||||||
<path>
|
|
||||||
<groupId>org.mapstruct</groupId>
|
|
||||||
<artifactId>mapstruct-processor</artifactId>
|
|
||||||
<version>${org.mapstruct.version}</version>
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>${org.projectlombok.version}</version>
|
|
||||||
</path>
|
|
||||||
</annotationProcessorPaths>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.mall.order.biz.convert;
|
|||||||
import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
|
import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO;
|
||||||
|
import cn.iocoder.mall.user.api.bo.UserAddressBO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -23,6 +24,9 @@ public interface OrderRecipientConvert {
|
|||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderRecipientDO convert(OrderCreateDTO orderCreateDTO);
|
OrderRecipientDO convert(OrderCreateDTO orderCreateDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OrderRecipientDO convert(UserAddressBO userAddressBO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderRecipientBO convert(OrderRecipientDO orderRecipientDO);
|
OrderRecipientBO convert(OrderRecipientDO orderRecipientDO);
|
||||||
|
|
||||||
|
@ -32,6 +32,10 @@ public class OrderItemDO extends DeletableDO {
|
|||||||
* 商品编号
|
* 商品编号
|
||||||
*/
|
*/
|
||||||
private Integer skuId;
|
private Integer skuId;
|
||||||
|
/**
|
||||||
|
* 物流id
|
||||||
|
*/
|
||||||
|
private Integer orderLogisticsId;
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
@ -52,10 +56,6 @@ public class OrderItemDO extends DeletableDO {
|
|||||||
* 支付金额(实付金额)
|
* 支付金额(实付金额)
|
||||||
*/
|
*/
|
||||||
private Integer payAmount;
|
private Integer payAmount;
|
||||||
/**
|
|
||||||
* 物流id
|
|
||||||
*/
|
|
||||||
private Integer orderLogisticsId;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// 时间信息
|
/// 时间信息
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.mall.order.biz.service;
|
package cn.iocoder.mall.order.biz.service;
|
||||||
|
|
||||||
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
||||||
|
import cn.iocoder.common.framework.util.DateUtil;
|
||||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||||
import cn.iocoder.common.framework.vo.CommonResult;
|
import cn.iocoder.common.framework.vo.CommonResult;
|
||||||
import cn.iocoder.mall.order.api.OrderService;
|
import cn.iocoder.mall.order.api.OrderService;
|
||||||
@ -8,6 +9,7 @@ import cn.iocoder.mall.order.api.bo.*;
|
|||||||
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderErrorCodeEnum;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum;
|
import cn.iocoder.mall.order.api.constant.OrderHasReturnExchangeEnum;
|
||||||
import cn.iocoder.mall.order.api.constant.OrderStatusEnum;
|
import cn.iocoder.mall.order.api.constant.OrderStatusEnum;
|
||||||
|
import cn.iocoder.mall.order.api.constant.PayAppId;
|
||||||
import cn.iocoder.mall.order.api.dto.*;
|
import cn.iocoder.mall.order.api.dto.*;
|
||||||
import cn.iocoder.mall.order.biz.OrderCommon;
|
import cn.iocoder.mall.order.biz.OrderCommon;
|
||||||
import cn.iocoder.mall.order.biz.constants.OrderDeliveryTypeEnum;
|
import cn.iocoder.mall.order.biz.constants.OrderDeliveryTypeEnum;
|
||||||
@ -18,10 +20,18 @@ import cn.iocoder.mall.order.biz.convert.OrderLogisticsConvert;
|
|||||||
import cn.iocoder.mall.order.biz.convert.OrderRecipientConvert;
|
import cn.iocoder.mall.order.biz.convert.OrderRecipientConvert;
|
||||||
import cn.iocoder.mall.order.biz.dao.*;
|
import cn.iocoder.mall.order.biz.dao.*;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.*;
|
import cn.iocoder.mall.order.biz.dataobject.*;
|
||||||
|
import cn.iocoder.mall.pay.api.PayTransactionService;
|
||||||
|
import cn.iocoder.mall.pay.api.dto.PayTransactionCreateDTO;
|
||||||
|
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||||
|
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||||
|
import cn.iocoder.mall.user.api.UserAddressService;
|
||||||
|
import cn.iocoder.mall.user.api.bo.UserAddressBO;
|
||||||
|
import com.alibaba.dubbo.config.annotation.Reference;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -37,6 +47,11 @@ import java.util.stream.Collectors;
|
|||||||
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
|
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
|
||||||
public class OrderServiceImpl implements OrderService {
|
public class OrderServiceImpl implements OrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付过期时间 15 分钟
|
||||||
|
*/
|
||||||
|
public static final int PAY_EXPIRE_TIME = 15;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderMapper orderMapper;
|
private OrderMapper orderMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -50,6 +65,13 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderCommon orderCommon;
|
private OrderCommon orderCommon;
|
||||||
|
|
||||||
|
@Reference
|
||||||
|
private ProductSpuService productSpuService;
|
||||||
|
@Reference
|
||||||
|
private UserAddressService userAddressService;
|
||||||
|
@Reference
|
||||||
|
private PayTransactionService payTransactionService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<OrderPageBO> getOrderPage(OrderQueryDTO orderQueryDTO) {
|
public CommonResult<OrderPageBO> getOrderPage(OrderQueryDTO orderQueryDTO) {
|
||||||
|
|
||||||
@ -61,6 +83,10 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
// 获取订单数据
|
// 获取订单数据
|
||||||
List<OrderDO> orderDOList = orderMapper.selectPage(orderQueryDTO);
|
List<OrderDO> orderDOList = orderMapper.selectPage(orderQueryDTO);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(orderDOList)) {
|
||||||
|
return CommonResult.success(new OrderPageBO().setOrders(Collections.EMPTY_LIST).setTotal(totalCount));
|
||||||
|
}
|
||||||
|
|
||||||
// 获取订单 id
|
// 获取订单 id
|
||||||
Set<Integer> orderIds = orderDOList.stream()
|
Set<Integer> orderIds = orderDOList.stream()
|
||||||
.map(orderDO -> orderDO.getId())
|
.map(orderDO -> orderDO.getId())
|
||||||
@ -133,33 +159,59 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public CommonResult<OrderCreateBO> createOrder(Integer userId, OrderCreateDTO orderCreateDTO) {
|
public CommonResult<OrderCreateBO> createOrder(OrderCreateDTO orderCreateDTO) {
|
||||||
|
Integer userId = orderCreateDTO.getUserId();
|
||||||
List<OrderCreateItemDTO> orderItemDTOList = orderCreateDTO.getOrderItems();
|
List<OrderCreateItemDTO> orderItemDTOList = orderCreateDTO.getOrderItems();
|
||||||
OrderRecipientDO orderRecipientDO = OrderRecipientConvert.INSTANCE.convert(orderCreateDTO);
|
|
||||||
List<OrderItemDO> orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList);
|
List<OrderItemDO> orderItemDOList = OrderItemConvert.INSTANCE.convert(orderItemDTOList);
|
||||||
|
|
||||||
// TODO: 2019-03-24 sin 校验商品是否存在
|
// 获取商品信息
|
||||||
// for (OrderItemDO orderItemDO : orderItemDOList) {
|
Set<Integer> skuIds = orderItemDOList.stream()
|
||||||
// CommonResult<ProductSpuDetailBO> result = productSpuService.getProductSpu(orderItemDO.getSkuId());
|
.map(orderItemDO -> orderItemDO.getSkuId()).collect(Collectors.toSet());
|
||||||
//
|
|
||||||
// // 有任何商品获取失败,或者为 null,都直接返回失败。
|
CommonResult<List<ProductSpuBO>> result = productSpuService.getProductSpuList(skuIds);
|
||||||
// if (result.isError()) {
|
|
||||||
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_SKU_FAIL.getCode());
|
// 校验商品信息
|
||||||
// }
|
if (result.isError()) {
|
||||||
//
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_SKU_FAIL.getCode());
|
||||||
// if (result.getData() == null) {
|
}
|
||||||
// return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_SKU_NOT_EXISTENT.getCode());
|
|
||||||
// }
|
if (result.getData() == null) {
|
||||||
//
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_SKU_NOT_EXISTENT.getCode());
|
||||||
// ProductSpuDetailBO spuDetailBO = result.getData();
|
}
|
||||||
// orderItemDO.setPrice(1000);
|
|
||||||
// }
|
if (orderItemDTOList.size() != result.getData().size()) {
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_GOODS_INFO_INCORRECT.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置 orderItem
|
||||||
|
|
||||||
|
Map<Integer, ProductSpuBO> productSpuBOMap = result.getData()
|
||||||
|
.stream().collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||||
|
|
||||||
|
for (OrderItemDO orderItemDO : orderItemDOList) {
|
||||||
|
ProductSpuBO productSpuBO = productSpuBOMap.get(orderItemDO.getSkuId());
|
||||||
|
if (productSpuBO.getQuantity() <= 0) {
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_INSUFFICIENT_INVENTORY.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (productSpuBO.getPrice() <= 0) {
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GOODS_AMOUNT_INCORRECT.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
orderItemDO.setSkuImage(Optional.ofNullable(productSpuBO.getPicUrls().get(0)).get());
|
||||||
|
orderItemDO.setSkuName(productSpuBO.getName());
|
||||||
|
orderItemDO.setPrice(productSpuBO.getPrice());
|
||||||
|
|
||||||
|
int payAmount = orderItemDO.getQuantity() * orderItemDO.getPrice();
|
||||||
|
orderItemDO.setPayAmount(payAmount);
|
||||||
|
}
|
||||||
|
|
||||||
// order
|
// order
|
||||||
|
Integer totalAmount = orderCommon.calculatedAmount(orderItemDOList);
|
||||||
OrderDO orderDO = new OrderDO()
|
OrderDO orderDO = new OrderDO()
|
||||||
.setUserId(userId)
|
.setUserId(userId)
|
||||||
.setOrderNo(UUID.randomUUID().toString().replace("-", ""))
|
.setOrderNo(UUID.randomUUID().toString().replace("-", ""))
|
||||||
.setPayAmount(-1) // 先设置一个默认值,金额在下面计算
|
.setPayAmount(totalAmount)
|
||||||
.setClosingTime(null)
|
.setClosingTime(null)
|
||||||
.setDeliveryTime(null)
|
.setDeliveryTime(null)
|
||||||
.setPaymentTime(null)
|
.setPaymentTime(null)
|
||||||
@ -173,6 +225,12 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
orderMapper.insert(orderDO);
|
orderMapper.insert(orderDO);
|
||||||
|
|
||||||
// 收件人信息
|
// 收件人信息
|
||||||
|
CommonResult<UserAddressBO> userAddressResult = userAddressService.getAddress(userId, orderCreateDTO.getUserAddressId());
|
||||||
|
if (userAddressResult.isError()) {
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_USER_ADDRESS_FAIL.getCode());
|
||||||
|
}
|
||||||
|
UserAddressBO userAddressBO = userAddressResult.getData();
|
||||||
|
OrderRecipientDO orderRecipientDO = OrderRecipientConvert.INSTANCE.convert(userAddressBO);
|
||||||
orderRecipientDO
|
orderRecipientDO
|
||||||
.setOrderId(orderDO.getId())
|
.setOrderId(orderDO.getId())
|
||||||
.setType(OrderRecipientTypeEnum.EXPRESS.getValue())
|
.setType(OrderRecipientTypeEnum.EXPRESS.getValue())
|
||||||
@ -183,14 +241,9 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
|
|
||||||
// order item
|
// order item
|
||||||
orderItemDOList.forEach(orderItemDO -> {
|
orderItemDOList.forEach(orderItemDO -> {
|
||||||
int goodsPrice = 1000; // 商品单价
|
|
||||||
orderItemDO
|
orderItemDO
|
||||||
.setOrderId(orderDO.getId())
|
.setOrderId(orderDO.getId())
|
||||||
.setOrderNo(orderDO.getOrderNo())
|
.setOrderNo(orderDO.getOrderNo())
|
||||||
.setPrice(goodsPrice)
|
|
||||||
.setPayAmount(orderItemDO.getQuantity() * orderItemDO.getPrice())
|
|
||||||
.setSkuName("夏季衣服-默认数据")
|
|
||||||
.setSkuImage("//img.alicdn.com/tps/i4/TB1TiGwKXXXXXXRXFXXqVMCNVXX-400-400.jpg_350x350q90.jpg_.webp")
|
|
||||||
.setPaymentTime(null)
|
.setPaymentTime(null)
|
||||||
.setDeliveryTime(null)
|
.setDeliveryTime(null)
|
||||||
.setReceiverTime(null)
|
.setReceiverTime(null)
|
||||||
@ -201,20 +254,31 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
.setDeleted(DeletedStatusEnum.DELETED_NO.getValue())
|
.setDeleted(DeletedStatusEnum.DELETED_NO.getValue())
|
||||||
.setCreateTime(new Date())
|
.setCreateTime(new Date())
|
||||||
.setUpdateTime(null);
|
.setUpdateTime(null);
|
||||||
|
|
||||||
orderItemMapper.insert(orderItemDO);
|
orderItemMapper.insert(orderItemDO);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 更新订单金额
|
// 创建预订单
|
||||||
Integer totalAmount = orderCommon.calculatedAmount(orderItemDOList);
|
// TODO sin 支付订单 orderSubject 暂时取第一个子订单商品信息
|
||||||
orderMapper.updateById(
|
String orderSubject = orderItemDOList.get(0).getSkuName();
|
||||||
new OrderDO()
|
Date expireTime = DateUtil.addDate(Calendar.MINUTE, PAY_EXPIRE_TIME);
|
||||||
.setId(orderDO.getId())
|
CommonResult commonResult = payTransactionService.createTransaction(
|
||||||
.setPayAmount(totalAmount)
|
new PayTransactionCreateDTO()
|
||||||
|
.setCreateIp(orderCreateDTO.getIp())
|
||||||
|
.setAppId(PayAppId.APP_ID_1024)
|
||||||
|
.setExpireTime(expireTime)
|
||||||
|
.setPrice(orderDO.getPayAmount())
|
||||||
|
.setOrderSubject(orderSubject)
|
||||||
|
.setOrderMemo(orderDO.getRemark())
|
||||||
|
.setOrderDescription("")
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息
|
if (commonResult.isError()) {
|
||||||
|
//手动开启事务回滚
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_GET_PAY_FAIL.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: 2019-03-17 Sin 需要发送 创建成果 MQ 消息,业务扩展和统计
|
||||||
return CommonResult.success(
|
return CommonResult.success(
|
||||||
new OrderCreateBO()
|
new OrderCreateBO()
|
||||||
.setId(orderDO.getId())
|
.setId(orderDO.getId())
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderItemMapper">
|
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderItemMapper">
|
||||||
|
|
||||||
<sql id="FIELDS">
|
<sql id="FIELDS">
|
||||||
id, order_id, order_no, sku_id, sku_name, sku_image, quantity, price, pay_amount,
|
id, order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id,
|
||||||
|
quantity, price, pay_amount,
|
||||||
payment_time, delivery_time, receiver_time, closing_time,
|
payment_time, delivery_time, receiver_time, closing_time,
|
||||||
has_return_exchange, delivery_type, status, create_time, update_time, deleted
|
has_return_exchange, delivery_type, status,
|
||||||
|
create_time, update_time, deleted
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
@ -13,11 +15,14 @@
|
|||||||
-->
|
-->
|
||||||
<insert id="insert" parameterType="OrderItemDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderItemDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order_item` (
|
INSERT INTO `order_item` (
|
||||||
order_id, order_no, sku_id, sku_name, sku_image, quantity, price, pay_amount,
|
order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id,
|
||||||
|
quantity, price, pay_amount,
|
||||||
payment_time, delivery_time, receiver_time, closing_time,
|
payment_time, delivery_time, receiver_time, closing_time,
|
||||||
has_return_exchange, delivery_type, status, create_time, update_time, deleted
|
has_return_exchange, delivery_type, status,
|
||||||
|
create_time, update_time, deleted
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{orderId}, #{orderNo}, #{skuId}, #{quantity}, #{price},
|
#{orderId}, #{orderNo}, #{skuId}, #{skuName}, #{skuImage}, #{orderLogisticsId},
|
||||||
|
#{quantity}, #{price}, #{payAmount},
|
||||||
#{paymentTime}, #{deliveryTime}, #{receiverTime}, #{closingTime},
|
#{paymentTime}, #{deliveryTime}, #{receiverTime}, #{closingTime},
|
||||||
#{hasReturnExchange}, #{deliveryType}, #{status},
|
#{hasReturnExchange}, #{deliveryType}, #{status},
|
||||||
#{createTime}, #{updateTime}, #{deleted}
|
#{createTime}, #{updateTime}, #{deleted}
|
||||||
|
@ -14,15 +14,15 @@
|
|||||||
-->
|
-->
|
||||||
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order` (
|
INSERT INTO `order` (
|
||||||
user_id, order_no, price, payment_time,
|
user_id, order_no, pay_amount, payment_time,
|
||||||
delivery_time, receiver_time, closing_time,
|
delivery_time, receiver_time, closing_time,
|
||||||
has_return_exchange, status, remark,
|
has_return_exchange,
|
||||||
create_time, update_time, `deleted`
|
status, remark, create_time, update_time, `deleted`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{userId}, #{orderNo}, #{price}, #{paymentTime},
|
#{userId}, #{orderNo}, #{payAmount}, #{paymentTime},
|
||||||
#{deliveryTime}, #{receiverTime}, #{closingTime},
|
#{deliveryTime}, #{receiverTime}, #{closingTime},
|
||||||
#{hasReturnExchange}, #{status}, #{remark},
|
#{hasReturnExchange},
|
||||||
#{createTime}, #{updateTime}, #{deleted}
|
#{status}, #{remark}, #{createTime}, #{updateTime}, #{deleted}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -36,24 +36,24 @@ public class OrderServiceImplTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createOrderTest() {
|
public void createOrderTest() {
|
||||||
|
//
|
||||||
Integer userId = 1;
|
// Integer userId = 1;
|
||||||
OrderCreateItemDTO orderCreateItemDTO
|
// OrderCreateItemDTO orderCreateItemDTO
|
||||||
= new OrderCreateItemDTO()
|
// = new OrderCreateItemDTO()
|
||||||
.setSkuId(1)
|
// .setSkuId(1)
|
||||||
.setQuantity(1);
|
// .setQuantity(1);
|
||||||
|
//
|
||||||
CommonResult<OrderCreateBO> result = orderService.createOrder(
|
// CommonResult<OrderCreateBO> result = orderService.createOrder(
|
||||||
userId,
|
// userId,
|
||||||
new OrderCreateDTO()
|
// new OrderCreateDTO()
|
||||||
.setRemark("")
|
// .setRemark("")
|
||||||
.setName("张三")
|
// .setName("张三")
|
||||||
.setMobile("13301926050")
|
// .setMobile("13301926050")
|
||||||
.setAddress("深圳市福田区")
|
// .setAddress("深圳市福田区")
|
||||||
.setAreaNo("1000100")
|
// .setAreaNo("1000100")
|
||||||
.setOrderItems(Arrays.asList(orderCreateItemDTO)));
|
// .setOrderItems(Arrays.asList(orderCreateItemDTO)));
|
||||||
|
//
|
||||||
OrderDO orderDO = orderMapper.selectById(result.getData().getId());
|
// OrderDO orderDO = orderMapper.selectById(result.getData().getId());
|
||||||
Assert.assertNotNull("创建的订单不存在!", orderDO);
|
// Assert.assertNotNull("创建的订单不存在!", orderDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,15 @@ package cn.iocoder.mall.user.api.bo;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sin
|
* @author Sin
|
||||||
* @time 2019-04-06 13:28
|
* @time 2019-04-06 13:28
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class UserAddressBO {
|
public class UserAddressBO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,11 +3,12 @@ package cn.iocoder.mall.user.api.bo;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class UserBO {
|
public class UserBO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
|
@ -3,11 +3,12 @@ package cn.iocoder.mall.user.api.bo;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class UserPageBO {
|
public class UserPageBO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户数组
|
* 用户数组
|
||||||
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
* @time 2019-04-06 13:26
|
* @time 2019-04-06 13:26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@com.alibaba.dubbo.config.annotation.Service(validation = "true")
|
||||||
public class UserAddressServiceImpl implements UserAddressService {
|
public class UserAddressServiceImpl implements UserAddressService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
Loading…
Reference in New Issue
Block a user