家政小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <style lang="less">
  2. @import '../../styles/common.less';
  3. </style>
  4. <template>
  5. <div>
  6. <Row class="margin-top-10" v-show="proShow">
  7. <Col>
  8. <Card>
  9. <p slot="title">
  10. <Icon type="android-remove"></Icon>
  11. 通用服务订单
  12. </p>
  13. <div class="edittable-table-height-con">
  14. <Table :columns="columns" :data="prosHandle"></Table>
  15. <Page :total="total" :page-size="pageSize" @on-change="getData"></Page>
  16. </div>
  17. </Card>
  18. </Col>
  19. </Row>
  20. <edit :editShow="editShow" :row="row" @close="closeModal"></edit>
  21. <detail v-show="!proShow" :form-content="formContent" @back="back"></detail>
  22. </div>
  23. </template>
  24. <script>
  25. import edit from "./edit";
  26. import detail from "./detail";
  27. export default {
  28. name: 'product',
  29. components: {
  30. edit,
  31. detail
  32. },
  33. computed: {
  34. prosHandle() {
  35. let products = [].concat(JSON.parse(JSON.stringify(this.products)));
  36. for (let product of products) {
  37. if (product.status == 0) {
  38. product.status = "待处理";
  39. } else if (product.status == 1) {
  40. product.status = "待支付";
  41. } else if (product.status == 2) {
  42. product.status = "已支付";
  43. } else if (product.status == 3) {
  44. product.status = "关闭";
  45. } else {
  46. product.status = "支付失败";
  47. }
  48. }
  49. return products;
  50. }
  51. },
  52. data () {
  53. return {
  54. row: {},
  55. total: 0,
  56. pageSize: 20,
  57. proShow: true,
  58. editShow: false,
  59. formContent: {},
  60. columns: [
  61. // {title: "id", key: 'id'},
  62. {title: "分类1", key: 'classify1'},
  63. {title: "分类2", key: 'classify2'},
  64. {title: "选项", key: 'options'},
  65. {title: "备注", key: 'notes'},
  66. {title: "联系人", key: 'contact', align: 'center'},
  67. {title: "联系电话", key: 'phone', align: 'center'},
  68. {title: "订单价格", key: 'price', align: 'center'},
  69. {title: "订单状态", key: 'status', align: 'center'},
  70. {
  71. title: "操作",
  72. key: "action",
  73. align: 'center',
  74. // width: 240,
  75. render: (h, params) => {
  76. return h('div', [
  77. h('Button', {
  78. props: {
  79. type: 'primary',
  80. size: 'default'
  81. },
  82. style: {
  83. marginRight: '5px'
  84. },
  85. on: {
  86. click: () => {
  87. this.formContent = params.row;
  88. this.proShow = false;
  89. }
  90. }
  91. }, '详情'),
  92. h('Button', {
  93. props: {
  94. type: 'primary',
  95. size: 'default'
  96. },
  97. style: {
  98. marginRight: '5px'
  99. },
  100. on: {
  101. click: () => {
  102. this.row = params.row;
  103. this.editShow = true;
  104. }
  105. }
  106. }, '修改'),
  107. h('Button', {
  108. props: {
  109. type: 'error',
  110. size: 'default'
  111. },
  112. style: {
  113. marginRight: '5px'
  114. },
  115. on: {
  116. click: () => {
  117. let id = params.row.id;
  118. this.$Modal.confirm({
  119. title: '注意',
  120. content: '确定要删除?',
  121. onOk: () => {
  122. this.axios.delete(`/option_order/${id}`)
  123. .then((res) => {
  124. this.products = this.products.filter((product) => {
  125. if (product.id != id) {
  126. return true;
  127. }
  128. });
  129. this.$Modal.remove();
  130. });
  131. },
  132. onCancel: () => {
  133. this.$Modal.remove();
  134. }
  135. });
  136. }
  137. }
  138. }, '删除')
  139. ]);
  140. }
  141. }
  142. ],
  143. products: []
  144. };
  145. },
  146. methods: {
  147. getData (num) {
  148. this.axios.get("/option_orders", {
  149. params: {
  150. page: num || 1
  151. }
  152. }).then((res) => {
  153. this.products = res.data.data;
  154. this.pageSize = res.data.per_page;
  155. this.total = res.data.total;
  156. });
  157. },
  158. closeModal(row) {
  159. this.editShow = false;
  160. if (row && row.id) {
  161. this.products.forEach((product, i) => {
  162. if (product.id == row.id) {
  163. product.price = row.price;
  164. this.$set(this.products, i, product);
  165. }
  166. });
  167. }
  168. },
  169. back() {
  170. this.proShow = true;
  171. }
  172. },
  173. created () {
  174. this.getData();
  175. }
  176. };
  177. </script>