|
@@ -1,91 +1,218 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<!-- 添加或修改订单对话框 -->
|
|
|
- <el-dialog :title="form.id?'编辑':'新增'" :close-on-click-modal="false" :visible.sync="visible" @close="close" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="120px" v-loading="loading">
|
|
|
- <el-form-item label="用户id" prop="appUserId">
|
|
|
- <el-input v-model="form.appUserId" placeholder="请输入用户id" clearable/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="商品id" prop="goodsId">
|
|
|
- <el-input v-model="form.goodsId" placeholder="请输入商品id" clearable/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="商品标题" prop="title">
|
|
|
- <el-input v-model="form.title" placeholder="请输入商品标题" clearable/>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="visible = false">取 消</el-button>
|
|
|
+ <el-dialog :title="form.id ? '编辑' : '新增'" :close-on-click-modal="false" :visible.sync="visible" @close="close" append-to-body>
|
|
|
+ <div class="act" v-loading="loading">
|
|
|
+ <div class="mt10">
|
|
|
+ <el-alert class="mt10" title="用户取消订单" type="error" :closable="false" v-if="form.state == -1">{{ form.payCancelTime }}</el-alert>
|
|
|
+ <el-alert class="mt10" title="订单已完成" type="success" :closable="false" v-if="form.state == 2">{{ form.updateTime }}</el-alert>
|
|
|
+ </div>
|
|
|
+ <div class="timeline_user">
|
|
|
+ <!--用户信息-->
|
|
|
+ <div class="lsw_flex" v-if="form.tbAppUser">
|
|
|
+ <div class="f1"><img :src="baseUrl + form.tbAppUser.avatar" class="head" /></div>
|
|
|
+ <div class="f" v-if="form.tbAppUser">
|
|
|
+ <div class="nick_name">{{ form.tbAppUser.nickName }}</div>
|
|
|
+ <div class="phone">{{ form.tbAppUser.mobile }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--操作时间线-->
|
|
|
+ <div class="timeline">
|
|
|
+ <el-timeline :reverse="false">
|
|
|
+ <el-timeline-item v-for="(activity, index) in activities" :color="activity.color" :timestamp="activity.timestamp">
|
|
|
+ {{ activity.content }}
|
|
|
+ <el-card v-if="activity.content == '创建订单'" class="mt5">
|
|
|
+ <div class="title">
|
|
|
+ <i class="el-icon-message-solid"></i>
|
|
|
+ 购买服务
|
|
|
+ </div>
|
|
|
+ <div class="describe">{{ form.title }}</div>
|
|
|
+ <div class="describe" style="margin-top: 10px;">备注:{{ form.notes }}</div>
|
|
|
+ </el-card>
|
|
|
+ <el-card v-if="activity.content == '支付成功'" class="mt5">
|
|
|
+ <div class="title">
|
|
|
+ <i class="el-icon-message-solid"></i>
|
|
|
+ 实付款
|
|
|
+ </div>
|
|
|
+ <div class="describe" style="font-size:29px;color: red;">¥ {{ form.money }}</div>
|
|
|
+ </el-card>
|
|
|
+ </el-timeline-item>
|
|
|
+ </el-timeline>
|
|
|
+ </div>
|
|
|
+ <!--操作时间线-->
|
|
|
+ </div>
|
|
|
+ <el-divider content-position="left"><span class="fs16">订单信息</span></el-divider>
|
|
|
+ <div class="bg">
|
|
|
+ <div class="lsw_row">
|
|
|
+ <div class="r1"><img :src="baseUrl + form.tbGoods.pic" class="pic" /></div>
|
|
|
+ <div class="r9">
|
|
|
+ <div>
|
|
|
+ {{ form.tbGoods.title }}
|
|
|
+ <span class="attr" style="margin-left:10px;">
|
|
|
+ <el-tag effect="dark">{{ form.tbGoods.tbGoodsType.name }}</el-tag>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="red mt5">¥ {{ form.money }}</div>
|
|
|
+ <div class="mt5">x {{ form.nums }}</div>
|
|
|
+ </div>
|
|
|
+ <div class="clearfix"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--合计-->
|
|
|
+ <div class="order_info">
|
|
|
+ <div class="v-title">
|
|
|
+ 合计:
|
|
|
+ <span class="red">¥{{ form.money }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="v-title">
|
|
|
+ 订单编号 :
|
|
|
+ <span class="bh">{{ form.orderNum }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="v-title">
|
|
|
+ 交易编号 :
|
|
|
+ <span class="bh">{{ form.transactionId }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="v-title" v-if="form.state == 1">
|
|
|
+ <el-dropdown @command="submitForm">
|
|
|
+ <el-button type="primary">
|
|
|
+ 订单操作
|
|
|
+ <i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown"><el-dropdown-item command="2">完成</el-dropdown-item></el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listOrders, getOrders, delOrders, addOrders, updateOrders, exportOrders } from "@/api/system/shop/orders";
|
|
|
+import { listOrders, getOrders, delOrders, addOrders, updateOrders, exportOrders } from '@/api/system/shop/orders';
|
|
|
import { getToken } from '@/utils/auth';
|
|
|
export default {
|
|
|
- components: {
|
|
|
- },
|
|
|
+ components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
+ baseUrl: process.env.VUE_APP_BASE_API,
|
|
|
// 遮罩层
|
|
|
loading: false,
|
|
|
visible: false,
|
|
|
// 表单参数
|
|
|
- form: {
|
|
|
- },
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- orderNum: [{ required: true, message: "订单编号不能为空", trigger: "blur" }],
|
|
|
- createTime: [{ required: true, message: "创建时间不能为空", trigger: "blur" }],
|
|
|
- }
|
|
|
+ form: {},
|
|
|
+ activities: []
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- },
|
|
|
+ created() {},
|
|
|
methods: {
|
|
|
/** 查询订单列表 */
|
|
|
init(id) {
|
|
|
- this.visible = true;
|
|
|
- if (id!='') {
|
|
|
- this.loading = true;
|
|
|
- getOrders(id).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- }
|
|
|
+ this.visible = true;
|
|
|
+ if (id != '') {
|
|
|
+ this.loading = true;
|
|
|
+ getOrders(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.activities = [];
|
|
|
+ this.activities.push({ content: '创建订单', timestamp: this.form.createTime, color: '#FF5722' });
|
|
|
+ if (this.form.state == 0) {
|
|
|
+ this.activities.push({ content: '待支付', timestamp: this.form.createTime, color: '#f56c6c' });
|
|
|
+ }
|
|
|
+ if (this.form.state > 0) {
|
|
|
+ this.activities.push({ content: '支付成功', timestamp: this.form.paySuccessTime, color: '#0bbd87' });
|
|
|
+ }
|
|
|
+ if (this.form.state == -1) {
|
|
|
+ this.activities.push({ content: '取消订单', timestamp: this.form.payCancelTime, color: '#f56c6c' });
|
|
|
+ }
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.id != null) {
|
|
|
- updateOrders(this.form).then(response => {
|
|
|
- if (response.code === 200) {
|
|
|
- this.msgSuccess("修改成功");
|
|
|
- this.$emit('refresh'); //刷新父组件数据
|
|
|
- this.visible = false;
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- addOrders(this.form).then(response => {
|
|
|
- if (response.code === 200) {
|
|
|
- this.msgSuccess("新增成功");
|
|
|
- this.$emit('refresh'); //刷新父组件数据
|
|
|
- this.visible = false;
|
|
|
- }
|
|
|
- });
|
|
|
+ /** 订单操作 */
|
|
|
+ submitForm(command) {
|
|
|
+ this.$confirm('是否确认完成!', '提示', { type: 'warning' }).then(() => {
|
|
|
+ this.form.state = command;
|
|
|
+ updateOrders(this.form).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess('操作成功');
|
|
|
+ this.$emit('refresh');
|
|
|
+ this.visible = false;
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
// 关闭弹窗表单重置
|
|
|
- close() {
|
|
|
- this.resetForm('form');
|
|
|
- this.form = {
|
|
|
- }
|
|
|
- },
|
|
|
+ close() {}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
+<style lang="scss">
|
|
|
+.lsw_flex {
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+.lsw_flex .f {
|
|
|
+ flex: 1;
|
|
|
+}
|
|
|
+.timeline_user {
|
|
|
+ margin-top: 20px;
|
|
|
+ .head {
|
|
|
+ width: 80px;
|
|
|
+ height: 80px;
|
|
|
+ border-radius: 50%;
|
|
|
+ }
|
|
|
+ .nick_name {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ padding-top: 20px;
|
|
|
+ padding-left: 10px;
|
|
|
+ }
|
|
|
+ .phone {
|
|
|
+ padding-top: 5px;
|
|
|
+ padding-left: 10px;
|
|
|
+ }
|
|
|
+ .timeline {
|
|
|
+ margin-top: 13px;
|
|
|
+ }
|
|
|
+ .title {
|
|
|
+ font-size: 15px;
|
|
|
+ text-align: left;
|
|
|
+ font-weight: bold;
|
|
|
+ margin: 0px auto 15px auto !important;
|
|
|
+ }
|
|
|
+ .describe {
|
|
|
+ color: grey;
|
|
|
+ margin-top: 10px;
|
|
|
+ font-size: 13px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.bg {
|
|
|
+ background-color: #e7e6e6;
|
|
|
+ padding: 10px;
|
|
|
+ border-radius: 3px;
|
|
|
+ font-size: 15px;
|
|
|
+ .lsw_row {
|
|
|
+ width: 100%;
|
|
|
+ .r1 {
|
|
|
+ float: left;
|
|
|
+ width: 10%;
|
|
|
+ img {
|
|
|
+ width: 65px;
|
|
|
+ height: 65px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .r9 {
|
|
|
+ width: 90%;
|
|
|
+ float: left;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.order_info {
|
|
|
+ margin-top: 20px;
|
|
|
+ .v-title {
|
|
|
+ font-size: 20px;
|
|
|
+ margin-top: 10px;
|
|
|
+ .bh {
|
|
|
+ color: darkgray;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|