订单详情

msb_beta
ch 3 years ago
parent e0b7d9d534
commit 39d7c5a2d5

@ -2,27 +2,49 @@
* @Author: ch
* @Date: 2022-03-29 17:38:17
* @LastEditors: ch
* @LastEditTime: 2022-03-30 15:25:23
* @LastEditTime: 2022-03-31 20:43:09
* @Description: file content
*/
import {ToAsyncAwait, Request} from '@/common/utils';
import orderList from '@/mock/orderList'
const ApiGetOrderList = (params) =>
/**
* 获取订单
* @param {*} params
*/
export const ApiGetOrderList = (params) =>
ToAsyncAwait(Request.get('/app/tradeOrder/page', params));
/**
* 获取预订单
* @param {*} data
*/
export const ApiGetBeforeOrder = (data) =>
ToAsyncAwait(Request.get('/app/tradeOrder/buyAdvanceOrder', data));
const ApiPostSubmitOrder = (data) =>
/**
* 订单详情
* @param {*} id
*/
export const ApiGetOrderDetail = (id) =>
ToAsyncAwait(Request.get(`/app/tradeOrder/${id}`));
/**
* 提交订单
* @param {*} data
*/
export const ApiPostSubmitOrder = (data) =>
ToAsyncAwait(Request.post('/app/tradeOrder/submitOrder', data));
const ApiPostWxPay = (data) =>
/**
* 取消订单
* @param {*} data
*/
export const ApiPutCancelOrder = (data) =>
ToAsyncAwait(Request.post('/app/tradeOrder/cancel', data));
/**
* 获取支付参数
* @param {*} data
*/
export const ApiPostWxPay = (data) =>
ToAsyncAwait(Request.post('/pay/wxPay/app', data));
export {
// 获取订单列表
ApiGetOrderList,
// 提交订单
ApiPostSubmitOrder,
// 获取支付参数
ApiPostWxPay
}

@ -2,18 +2,18 @@
* @Author: ch
* @Date: 2022-03-29 16:47:32
* @LastEditors: ch
* @LastEditTime: 2022-03-29 17:14:26
* @LastEditTime: 2022-03-31 18:07:46
* @Description: file content
*/
import Enum from "@/common/plugins/enum"
const DictOrderStatus = new Enum([
{key : '1', name : '待支付'},
{key : '2', name : '已关闭'},
{key : '3', name : '待发货'},
{key : '4', name : '已发货'},
{key : '6', name : '已收货'},
{key : '7', name : '已完成'}
{key : '1', name : '待支付', value: 'awaitPay'},
{key : '2', name : '已关闭', value: 'close'},
{key : '3', name : '待发货', value: 'awaitSend'},
{key : '4', name : '已发货', value: 'finishSend'},
{key : '6', name : '已收货', value: 'finishReceiving'},
{key : '7', name : '已完成', value: 'end'}
])
export {

@ -2,11 +2,11 @@
* @Author: ch
* @Date: 2022-03-26 10:06:38
* @LastEditors: ch
* @LastEditTime: 2022-03-30 15:12:56
* @LastEditTime: 2022-03-31 21:16:11
* @Description: file content
-->
<template>
<button :class="`btn btn__${type} btn__${size}`" @click="$emit('click')"><slot></slot></button>
<button :class="`btn btn__${type} btn__${size}${(disabed ? ' btn__disabed' : '')}`" @click="click"><slot></slot></button>
</template>
<script>
export default {
@ -18,6 +18,15 @@ export default {
size : {
type : String,
default : 'normal' //normal 60 max 80
},
disabed:{
type : Boolean,
default : false
}
},
methods:{
click(){
!this.disabed && this.$emit('click');
}
}
}
@ -56,5 +65,8 @@ export default {
color: #FF875B;
border: 1px solid #FF875B;
}
&__disabed{
opacity: .8;
}
}
</style>

@ -0,0 +1,77 @@
<!--
* @Author: ch
* @Date: 2022-03-31 14:49:33
* @LastEditors: ch
* @LastEditTime: 2022-03-31 20:26:25
* @Description: file content
-->
<template>
<view class="uiGoods">
<image class="uiGoods--image" mode="widthFix" :src="data.productImageUrl" />
<view >
<view class="uiGoods--con">
<text class="uiGoods--title">{{data.productName}}</text>
<text class="uiGoods--pirce">{{data.realAmount}}</text>
</view>
<view class="uiGoods--desc">
<text>{{data.skuDescribe}}</text>
<text class="uiGoods--num">x{{data.quantity}}</text>
</view>
</view>
</view>
</template>
<script>
export default {
props : {
data : {
type : Object,
default : {}
}
}
}
</script>
<style lang="scss" scoped>
.uiGoods{
display: flex;
justify-content: space-between;
padding: 30rpx;
border-bottom: 1px solid #eee;
&--image{
width: 180rpx;
height: 180rpx;
margin-right: 30rpx;
}
&--con{
width: 510rpx;
display: flex;
justify-content: space-between;
font-size: 28rpx;
color: #333;
line-height: 39rpx;
}
&--title{
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-box-orient:vertical;
-webkit-line-clamp:2;
}
&--pirce{
font-size: 22rpx;
margin-left: 60rpx;
}
&--desc{
width: 510rpx;
font-size: 24rpx;
color: #999;
margin-top: 20rpx;
line-height: 39rpx;
display: flex;
justify-content: space-between;
}
&--num{
font-size: 28rpx;
margin-left: 60rpx;
}
}
</style>

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-25 10:11:37
* @LastEditors: ch
* @LastEditTime: 2022-03-28 17:07:56
* @LastEditTime: 2022-03-31 15:23:53
* @Description: file content
-->
<template>

@ -0,0 +1,19 @@
<!--
* @Author: ch
* @Date: 2022-03-31 15:42:55
* @LastEditors: ch
* @LastEditTime: 2022-03-31 16:23:32
* @Description: file content
-->
<template>
<view class="uiWhiteBox">
<slot></slot>
</view>
</template>
<style lang="scss" scoped>
.uiWhiteBox{
margin: 20rpx 30rpx;
background: #fff;
border-radius: 20rpx;
}
</style>

@ -134,6 +134,13 @@
"navigationBarTitleText": "提交订单"
}
},
{
"path": "pages/order/detail/index",
"aliasPath" : "/orderDetail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/order/paySuccess",
"style": {

@ -248,7 +248,7 @@ import UiPageHeader from '../../components/UiPageHeader.vue';
//
handleOrder() {
const app = this
app.$Router.push('/orderSubmit')
app.$Router.push({path : '/orderSubmit', query:{mode: 'cart', ids : '1,2,3'}})
if (app.checkedIds.length) {
const cartIds = app.checkedIds.join()
app.$Router.push('orderSubmit', { mode: 'cart', cartIds })

@ -154,12 +154,18 @@
//
buyNow(selectShop) {
//
this.$navTo('pages/checkout/index', {
this.$Router.push({path : '/orderSubmit', query:{
mode: 'buyNow',
goodsId: selectShop.goods_id,
goodsSkuId: selectShop.goods_sku_id,
goodsNum: selectShop.buy_num
})
skuId: selectShop.goods_sku_id,
num: selectShop.buy_num
}})
// this.$navTo('pages/checkout/index', {
// mode: 'buyNow',
// goodsId: selectShop.goods_id,
// goodsSkuId: selectShop.goods_sku_id,
// goodsNum: selectShop.buy_num
// })
//
this.onChangeValue(false)
}

@ -154,12 +154,17 @@
//
buyNow(selectShop) {
//
this.$navTo('pages/checkout/index', {
this.$Router.push({path : '/orderSubmit', query:{
mode: 'buyNow',
goodsId: selectShop.goods_id,
goodsSkuId: selectShop.goods_sku_id,
goodsNum: selectShop.buy_num
})
skuId: selectShop.goods_sku_id,
num: selectShop.buy_num
}})
// this.$navTo('pages/checkout/index', {
// mode: 'buyNow',
// goodsId: selectShop.goods_id,
// goodsSkuId: selectShop.goods_sku_id,
// goodsNum: selectShop.buy_num
// })
//
this.onChangeValue(false)
}

@ -0,0 +1,103 @@
<!--
* @Author: ch
* @Date: 2022-03-31 17:53:43
* @LastEditors: ch
* @LastEditTime: 2022-03-31 20:43:19
* @Description: file content
-->
<template>
<view class="status">
<image class="status--icon" :src="ctxCon.icon"></image>
<view class="status--name">{{ctxCon.name}}</view>
<view class="status--desc">{{ctxCon.tips}}</view>
</view>
</template>
<script>
import {DictOrderStatus } from '@/common/dicts/order'
import Enum from "@/common/plugins/enum"
export default {
props : {
orderInfo : {
type : Object,
default : {}
}
},
data(){
return {
ctxData : {
awaitPay : {name:'待付款', tips:'', icon: require('@/static/order/fk.png')},
close : {name:'交易关闭' , tips:'关闭原因', icon: require('@/static/order/qx.png')},
awaitSend : {name:'等待发货', tips:'您的包裹整装待发', icon: require('@/static/order/fh.png')},
finishSend : {name:'已发货', tips:'您的包裹正向您飞来', icon: require('@/static/order/fh.png')},
finishReceiving : {name:'已收货', icon: require('@/static/order/fh.png')},
end : {name:'交易成功', icon: require('@/static/order/cg.png')},
},
ctxCon : {},
secondNum : 0
}
},
mounted(){
},
watch : {
orderInfo(nVal){
this.ctxCon = this.ctxData[this.statusKey];
if(this.statusKey === 'awaitPay'){
let expireTime = (new Date(this.orderInfo.expireTime)).getTime(),
curTime = (new Date(this.orderInfo.serverTime)).getTime(),
second = Math.floor((expireTime - curTime) / 1000);
this.secondNum = second > 0 ? second : 0;
this.timer()
}else if(this.statusKey === 'close'){
this.ctxCon.tips = this.orderInfo.closeReason;
}
}
},
computed:{
// key
statusKey (){
return DictOrderStatus[this.orderInfo.orderStatus].value
}
},
methods:{
/**
* 待付款的计时器
*/
timer(){
if(this.secondNum == 0){
this.$emit('close');
return;
}
this.secondNum--;
let minute = parseInt(this.secondNum / 60);
let second = parseInt(this.secondNum % 60);
this.ctxCon.tips = `剩余${minute > 0 ? `${minute}` : ''} ${second}`;
// console.log(this.ctxCon.tips);
setTimeout(()=>this.timer(),1000)
}
}
}
</script>
<style lang="scss" scoped>
.status{
padding: 30rpx 60rpx 0;
position: relative;
&--icon{
width: 100rpx;
height: 100rpx;
position: absolute;
right: 60rpx;
top: 10rpx;
}
&--name{
font-size: 36rpx;
margin-bottom: 20rpx;
}
&--desc{
font-size: 28rpx;
color: #999;
margin-bottom: 48rpx;
}
}
</style>

@ -0,0 +1,235 @@
<!--
* @Author: ch
* @Date: 2022-03-31 14:26:09
* @LastEditors: ch
* @LastEditTime: 2022-03-31 22:45:02
* @Description: file content
-->
<template>
<view>
<StatusTips :orderInfo="orderInfo" @close="timerCloseOrder"></StatusTips>
<UiWhiteBox>
<UiGoodsInfo v-for="(item, index) in orderInfo.products" :data="item" :key="index"></UiGoodsInfo>
</UiWhiteBox>
<UiWhiteBox>
<u-cell class="address" title="是的发生的" label="陈先生 190****2342"
:border="false" isLink @click="$Router.push('/addressList')">
<image class="address--icon" slot="icon" src="@/static/order/dw.png" />
</u-cell>
</UiWhiteBox>
<UiWhiteBox class="cellBox">
<view class="cell">
<text class="cell--title">订单编号:</text>
<text class="cell--value">{{orderInfo.orderNo}}</text>
</view>
<view class="cell">
<text class="cell--title">订单时间:</text>
<text class="cell--value">{{orderInfo.submitTime}}</text>
</view>
<view class="cell">
<text class="cell--title">支付方式:</text>
<text class="cell--value">{{orderInfo.payTypeDesc}}</text>
</view>
<view class="cell">
<text class="cell--title">买家留言:</text>
<text class="cell--value">{{orderInfo.userMessage}}</text>
</view>
</UiWhiteBox>
<UiWhiteBox class="cellBox">
<view class="cell">
<text class="cell--title">商品总额:</text>
<text class="cell--value">{{orderInfo.totalAmount}}</text>
</view>
<view class="cell">
<text class="cell--title">运费:</text>
<text class="cell--value">{{orderInfo.shippingAmount}}</text>
</view>
</UiWhiteBox>
<view class="footer">
<UiButton>查看物流</UiButton>
<UiButton class="footer--btn" @click="cancelShow = true">取消订单</UiButton>
<UiButton class="footer--btn" type="gradual">去支付</UiButton>
</view>
<u-popup :show="cancelShow" @close="closeCancel" round="16rpx" closeable>
<view class="cancel--title">取消订单原因</view>
<radio-group class="cancel--cell" @change="cancelChange">
<UiCell title="我不想买了">
<radio slot="right-icon" value="1" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="地址信息填写错误">
<radio slot="right-icon" value="2" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="商品降价">
<radio slot="right-icon" value="3" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="商品无货">
<radio slot="right-icon" value="4" class="cancel--radio" color="#FF875B"/>
</UiCell>
<UiCell title="其他">
<radio slot="right-icon" value="5" class="cancel--radio" color="#FF875B"/>
</UiCell>
</radio-group>
<view class="cancel--footer">
<UiButton @click="closeCancel"></UiButton>
<UiButton type="gradual" :disabed="cancelValue == 0">确认取消</UiButton>
</view>
</u-popup>
</view>
</template>
<script>
import UiPageHeader from '@/components/UiPageHeader.vue'
import UiGoodsInfo from '../../../components/UiGoodsInfo.vue'
import UiWhiteBox from '../../../components/UiWhiteBox.vue'
import {ApiGetOrderDetail,ApiPutCancelOrder} from '@/common/api/order'
import UiButton from '../../../components/UiButton.vue'
import StatusTips from './StatusTips.vue'
import UiCell from '../../../components/UiCell.vue'
export default {
components: { UiPageHeader, UiGoodsInfo, UiWhiteBox, UiButton, StatusTips, UiCell },
data(){
return {
orderInfo : {
products:[]
},
//
cancelShow : false,
cancelValue : 0
}
},
onLoad(){
this.getOrderInfo();
},
methods : {
/**
* 获取订单最新信息
*/
async getOrderInfo(){
const {error, result} = await ApiGetOrderDetail(this.$Route.query.id);
if(error){
uni.$u.totast(error.message);
return false;
}
this.orderInfo = {...result, orderStatus : 7};
},
/**
* 超时自动关闭订单
*/
timerCloseOrder(){
this.orderInfo = {...this.orderInfo, orderStatus : 2, closeReason:'超时未支付'};
// this.getOrderInfo();
},
closeCancel(){
this.cancelShow = false;
this.cancelValue = 0;
},
cancelChange(val){
this.cancelValue = val;
},
async cancelOrder(){
const {error, result} = await ApiPutCancelOrder(this.$Route.query.id);
if(error){
uni.$u.totast(error.message);
return false;
}
//
}
}
}
</script>
<style lang="scss" scoped>
page{
// background: linear-gradient(180deg, #FDF9F5 0%, rgba(254, 253, 252, 0) 50%) #f8f8f8;
background: #f8f8f8;
padding-bottom: 138rpx;
}
.header{
background: none;
}
.address{
// background: #fff;
&--icon{
width: 28rpx;
height: 34rpx;
margin-right: 30rpx;
}
}
.status{
padding: 30rpx 60rpx 0;
position: relative;
&--icon{
width: 100rpx;
height: 100rpx;
position: absolute;
right: 60rpx;
top: 10rpx;
}
&--name{
font-size: 36rpx;
margin-bottom: 20rpx;
}
&--desc{
font-size: 28rpx;
color: #999;
margin-bottom: 48rpx;
}
}
.cellBox{
padding: 30rpx;
}
.cell{
height: 56rpx;
line-height: 56rpx;
display: flex;
justify-content: space-between;
&--value{
font-size: 24rpx;
}
&--title{
color: #999;
font-size: 24rpx;
}
}
.footer{
height: 138rpx;
padding: 0 30rpx;
background: #fff;
position: fixed;
bottom: 0;
left: 0;
right: 0;
display: flex;
justify-content: flex-end;
align-items: center;
&--btn{
display: block;
margin: 0 0 0 30rpx;
}
}
.cancel{
&--title{
text-align: center;
font-size: 34rpx;
margin: 40rpx 0 30rpx;
}
&--cell{
padding: 0 40rpx;
}
&--footer{
padding: 68rpx 40rpx;
display: flex;
justify-content: space-between;
}
&--radio{
transform: scale(60%);
}
}
</style>

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-22 10:58:24
* @LastEditors: ch
* @LastEditTime: 2022-03-30 14:23:17
* @LastEditTime: 2022-03-31 15:59:03
* @Description: file content
-->
<template>
@ -21,7 +21,7 @@
<text class="orders--name">官方自营</text>
<text class="orders--status" :class="[1,3].includes(item.orderStatus) && 'orders--status__warn'">{{item.orderStatusDesc}}</text>
</view>
<view class="orders--item" v-for="i in item.products" :key="i.productId">
<view class="orders--item" v-for="i in item.products" :key="i.productId" @click="$Router.push(`/orderDetail?id=${item.orderId}`)">
<image class="orders--item-image" mode="widthFix" :src="i.productImageUrl" />
<view >
<view class="orders--item-con">

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-03-20 14:14:53
* @LastEditors: ch
* @LastEditTime: 2022-03-30 18:56:51
* @LastEditTime: 2022-03-31 14:21:15
* @Description: file content
-->
<template>
@ -13,16 +13,16 @@
</u-cell>
<view class="goods-group">
<view class="goods-group--item" v-for="item in goodsData" :key="item.productId">
<image class="goods-group--item-image" mode="widthFix" src="http://static.yoshop.xany6.com/2018071717370507f183424.jpg" />
<view class="goods-group--item" v-for="item in orderInfo.products" :key="item.productId">
<image class="goods-group--item-image" mode="widthFix" :src="item.productImageUrl" />
<view >
<view class="goods-group--item-con">
<text class="goods-group--item-title">商品标题商品标题商品标题商品标题商品标题</text>
<text class="goods-group--item-pirce">1922.00</text>
<text class="goods-group--item-title">{{item.productName}}</text>
<text class="goods-group--item-pirce">{{item.productPrice}}</text>
</view>
<view class="goods-group--item-desc">
<text>多线程与高并发内部教材+试听课</text>
<text class="goods-group--item-num">x1</text>
<text>{{item.skuDescribe}}</text>
<text class="goods-group--item-num">x{{item.quantity}}</text>
</view>
</view>
</view>
@ -53,14 +53,14 @@
<view class="amount">
<u-cell title="商品总额" value="¥19923.00" :border="false"></u-cell>
<u-cell title="运费" value="¥0.00" :border="false"></u-cell>
<u-cell title="商品总额" :value="`¥${orderInfo.totalAmount}`" :border="false"></u-cell>
<u-cell title="运费" :value="`¥${orderInfo.shippingAmount}`" :border="false"></u-cell>
</view>
<view class="footer">
<view class="footer--total">
<text>合计</text>
<text class="footer--amount">19923.00</text>
<text class="footer--amount">{{orderInfo.payAmount}}</text>
</view>
<UiButton class="footer--btn" type="solid" @click="submit"></UiButton>
</view>
@ -71,7 +71,7 @@
<script>
import UiCell from '@/components/UiCell';
import {ApiPostSubmitOrder, ApiPostWxPay} from '@/common/api/order';
import {ApiPostSubmitOrder, ApiPostWxPay, ApiGetBeforeOrder} from '@/common/api/order';
import UiButton from '@/components/UiButton.vue';
export default {
components : {UiCell, UiButton },
@ -82,26 +82,35 @@ export default {
label : '陈先生 189****6782'
},
userMessage : '',
goodsData : [
{
productId : 1,
productSkuId : 1,
quantity : 1
},
{
productId : 2,
productSkuId : 2,
quantity : 2
}
]
orderInfo : {}
}
},
onLoad(){
this.getBeforeOrder();
},
methods:{
/**
* 获取预订单信息将要提交的订单信息
*/
getBeforeOrder(){
async getBeforeOrder(){
const query = this.$Route.query;
let apiParams = {};
//
if(query.mode === 'cart'){
apiParams.productIds = query.ids;
}
//
if(query.mode === 'buyNow'){
apiParams.productSkuId = parseInt(query.skuId);
apiParams.quantity = query.num;
}
const {error, result} = await ApiGetBeforeOrder(apiParams);
if(error){
uni.$u.toast(error.message);
return false;
}
this.orderInfo = result;
},
/**

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 760 B

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Loading…
Cancel
Save