123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <style lang="less">
- @import '../../styles/common.less';
- </style>
-
- <template>
- <div>
- <Row class="margin-top-10" v-show="proShow">
- <Col>
- <Card>
- <p slot="title">
- <Icon type="android-remove"></Icon>
- 通用服务订单
- </p>
- <div class="edittable-table-height-con">
- <Table :columns="columns" :data="prosHandle"></Table>
- <Page :total="total" :page-size="pageSize" @on-change="getData"></Page>
- </div>
- </Card>
- </Col>
- </Row>
- <edit :editShow="editShow" :row="row" @close="closeModal"></edit>
- <detail v-show="!proShow" :form-content="formContent" @back="back"></detail>
- </div>
- </template>
-
- <script>
- import edit from "./edit";
- import detail from "./detail";
- export default {
- name: 'product',
- components: {
- edit,
- detail
- },
- computed: {
- prosHandle() {
- let products = [].concat(JSON.parse(JSON.stringify(this.products)));
- for (let product of products) {
- if (product.status == 0) {
- product.status = "待处理";
- } else if (product.status == 1) {
- product.status = "待支付";
- } else if (product.status == 2) {
- product.status = "已支付";
- } else if (product.status == 3) {
- product.status = "关闭";
- } else {
- product.status = "支付失败";
- }
- }
- return products;
- }
- },
- data () {
- return {
- row: {},
- total: 0,
- pageSize: 20,
- proShow: true,
- editShow: false,
- formContent: {},
- columns: [
- // {title: "id", key: 'id'},
- {title: "分类1", key: 'classify1'},
- {title: "分类2", key: 'classify2'},
- {title: "选项", key: 'options'},
- {title: "备注", key: 'notes'},
- {title: "联系人", key: 'contact', align: 'center'},
- {title: "联系电话", key: 'phone', align: 'center'},
- {title: "订单价格", key: 'price', align: 'center'},
- {title: "订单状态", key: 'status', align: 'center'},
- {
- title: "操作",
- key: "action",
- align: 'center',
- // width: 240,
- render: (h, params) => {
- return h('div', [
- h('Button', {
- props: {
- type: 'primary',
- size: 'default'
- },
- style: {
- marginRight: '5px'
- },
- on: {
- click: () => {
- this.formContent = params.row;
- this.proShow = false;
- }
- }
- }, '详情'),
- h('Button', {
- props: {
- type: 'primary',
- size: 'default'
- },
- style: {
- marginRight: '5px'
- },
- on: {
- click: () => {
- this.row = params.row;
- this.editShow = true;
- }
- }
- }, '修改'),
- h('Button', {
- props: {
- type: 'error',
- size: 'default'
- },
- style: {
- marginRight: '5px'
- },
- on: {
- click: () => {
- let id = params.row.id;
- this.$Modal.confirm({
- title: '注意',
- content: '确定要删除?',
- onOk: () => {
- this.axios.delete(`/option_order/${id}`)
- .then((res) => {
- this.products = this.products.filter((product) => {
- if (product.id != id) {
- return true;
- }
- });
- this.$Modal.remove();
- });
- },
- onCancel: () => {
- this.$Modal.remove();
- }
- });
-
- }
- }
- }, '删除')
- ]);
- }
- }
- ],
- products: []
- };
- },
- methods: {
- getData (num) {
- this.axios.get("/option_orders", {
- params: {
- page: num || 1
- }
- }).then((res) => {
- this.products = res.data.data;
- this.pageSize = res.data.per_page;
- this.total = res.data.total;
- });
- },
- closeModal(row) {
- this.editShow = false;
- if (row && row.id) {
- this.products.forEach((product, i) => {
- if (product.id == row.id) {
- product.price = row.price;
- this.$set(this.products, i, product);
- }
- });
- }
- },
- back() {
- this.proShow = true;
- }
- },
- created () {
- this.getData();
- }
- };
- </script>
|