|
|
@@ -6,7 +6,11 @@
|
|
|
<el-table-column prop="userId" label="用户ID" width="100">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="product.name" label="商品名称"></el-table-column>
|
|
|
- <el-table-column width="150" align="center">
|
|
|
+ <el-table-column prop="createdAt" label="下单时间" width="200">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="payTime" label="付款时间" width="200">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="150" label="操作" align="left">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-button type="primary" size="mini" @click="edit(row)">编辑
|
|
|
</el-button>
|
|
|
@@ -19,6 +23,23 @@
|
|
|
<pagination :page-size="pageSize" :current-page="page"
|
|
|
:total="totalElements" @size-change="onSizeChange"
|
|
|
@current-change="onCurrentChange"></pagination>
|
|
|
+ <el-dialog :visible.sync="showShipDialog" title="发货">
|
|
|
+ <el-form :model="shipInfo" label-width="80px" label-position="right"
|
|
|
+ size="small" ref="shipForm" :rules="shipRules">
|
|
|
+ <el-form-item prop="expressCompany" label="物流公司">
|
|
|
+ <el-input v-model="shipInfo.expressCompany"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="trackingNo" label="物流单号">
|
|
|
+ <el-input v-model="shipInfo.trackingNo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer">
|
|
|
+ <el-button @click="showShipDialog=false" size="small">取消
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="confirmShip" size="small" type="primary">确定
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -27,7 +48,18 @@ import paginationMixin from '@/mixins/pagination';
|
|
|
export default {
|
|
|
mixins: [paginationMixin],
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ showShipDialog: false,
|
|
|
+ shipInfo: {
|
|
|
+ expressCompany: '',
|
|
|
+ trackingNo: '',
|
|
|
+ },
|
|
|
+ selectedOrder: {},
|
|
|
+ shipRules: {
|
|
|
+ expressCompany: [{ required: true, message: '请输入物流公司', trigger: 'blur' }],
|
|
|
+ trackingNo: [{ required: true, message: '请输入物流单号', trigger: 'blur' }],
|
|
|
+ },
|
|
|
+ };
|
|
|
},
|
|
|
methods: {
|
|
|
getData() {
|
|
|
@@ -56,32 +88,37 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
ship(row) {
|
|
|
- this.$prompt('请输入物流单号', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- inputValidator(val) {
|
|
|
- if (val) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return '请输入物流单号';
|
|
|
- },
|
|
|
- })
|
|
|
- .then(({ value }) => {
|
|
|
- row.trackingNo = value;
|
|
|
- row.status = 'DELIVERING';
|
|
|
- return this.$axios.post('/order/save', row);
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- if (res.data.success) {
|
|
|
- this.$message.success('成功');
|
|
|
- this.getData();
|
|
|
- } else {
|
|
|
- this.$message.error(res.data.error);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- console.log(e);
|
|
|
- });
|
|
|
+ this.selectedOrder = row;
|
|
|
+ this.shipInfo = {
|
|
|
+ expressCompany: '',
|
|
|
+ trackingNo: '',
|
|
|
+ };
|
|
|
+ this.showShipDialog = true;
|
|
|
+ },
|
|
|
+ confirmShip() {
|
|
|
+ this.$refs.shipForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.showShipDialog = false;
|
|
|
+ let order = { ...this.selectedOrder };
|
|
|
+ order.trackingNo = this.shipInfo.trackingNo;
|
|
|
+ order.expressCompany = this.shipInfo.expressCompany;
|
|
|
+ order.status = 'DELIVERING';
|
|
|
+ order.shipTime = new Date().format('yyyy-MM-dd HH:mm:ss');
|
|
|
+ this.$axios
|
|
|
+ .post('/order/save', order)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.success) {
|
|
|
+ this.$message.success('成功');
|
|
|
+ this.getData();
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.error);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
};
|