|
|
@@ -15,17 +15,17 @@
|
|
|
<el-button type="primary" size="mini" @click="edit(row)">编辑
|
|
|
</el-button>
|
|
|
<el-button v-if="row.status === 'PAID'" type="primary"
|
|
|
- size="mini" @click="ship(row)">发货
|
|
|
+ size="mini" @click="ship(row)">发货
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<pagination :page-size="pageSize" :current-page="page"
|
|
|
- :total="totalElements" @size-change="onSizeChange"
|
|
|
- @current-change="onCurrentChange"></pagination>
|
|
|
+ :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">
|
|
|
+ size="small" ref="shipForm" :rules="shipRules">
|
|
|
<el-form-item prop="expressCompany" label="物流公司">
|
|
|
<el-input v-model="shipInfo.expressCompany"></el-input>
|
|
|
</el-form-item>
|
|
|
@@ -44,85 +44,88 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import paginationMixin from '@/mixins/pagination';
|
|
|
-export default {
|
|
|
- mixins: [paginationMixin],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- showShipDialog: false,
|
|
|
- shipInfo: {
|
|
|
- expressCompany: '',
|
|
|
- trackingNo: '',
|
|
|
- },
|
|
|
- selectedOrder: {},
|
|
|
- shipRules: {
|
|
|
- expressCompany: [{ required: true, message: '请输入物流公司', trigger: 'blur' }],
|
|
|
- trackingNo: [{ required: true, message: '请输入物流单号', trigger: 'blur' }],
|
|
|
- },
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
- getData() {
|
|
|
- this.$http
|
|
|
- .get('/order/all', {
|
|
|
- page: this.page,
|
|
|
- size: this.pageSize,
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- if (res.success) {
|
|
|
- this.tableData = res.data.content;
|
|
|
- this.totalPages = res.data.totalPages;
|
|
|
- this.totalElements = res.data.totalElements;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- edit(row) {
|
|
|
- this.$router.push({
|
|
|
- name: 'orderEdit',
|
|
|
- query: {
|
|
|
- id: row.id,
|
|
|
+ import paginationMixin from '@/mixins/pagination';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ mixins: [paginationMixin],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ showShipDialog: false,
|
|
|
+ shipInfo: {
|
|
|
+ expressCompany: '',
|
|
|
+ trackingNo: '',
|
|
|
},
|
|
|
- params: {
|
|
|
- formData: row,
|
|
|
+ selectedOrder: {},
|
|
|
+ shipRules: {
|
|
|
+ expressCompany: [{required: true, message: '请输入物流公司', trigger: 'blur'}],
|
|
|
+ trackingNo: [{required: true, message: '请输入物流单号', trigger: 'blur'}],
|
|
|
},
|
|
|
- });
|
|
|
- },
|
|
|
- ship(row) {
|
|
|
- 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);
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ methods: {
|
|
|
+ getData() {
|
|
|
+ console.log(111)
|
|
|
+ this.$http
|
|
|
+ .get('/order/all', {
|
|
|
+ page: this.page,
|
|
|
+ size: this.pageSize,
|
|
|
+ sort: 'createdAt,desc'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.tableData = res.data.content;
|
|
|
+ this.totalPages = res.data.totalPages;
|
|
|
+ this.totalElements = res.data.totalElements;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ edit(row) {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'orderEdit',
|
|
|
+ query: {
|
|
|
+ id: row.id,
|
|
|
+ },
|
|
|
+ params: {
|
|
|
+ formData: row,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ ship(row) {
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
-</style>
|
|
|
+</style>
|