order.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <div>
  3. <Card :bordered="false" dis-hover class="mt15">
  4. <Form ref="orderData" :model="orderData" :label-width="labelWidth" :label-position="labelPosition"
  5. class="tabform" @submit.native.prevent>
  6. <div class="acea-row">
  7. <FormItem label="时间选择:">
  8. <DatePicker :editable="false" :clearable="true" @on-change="onchangeTime" :value="timeVal"
  9. format="yyyy/MM/dd HH:mm:ss" type="datetimerange" placement="bottom-start"
  10. placeholder="自定义时间" style="width: 250px" class="mr30" :options="options"></DatePicker>
  11. </FormItem>
  12. <FormItem label="订单审核:">
  13. <Select v-model="orderData.status" style="width: 250px" class="mr30" clearable
  14. @on-change="userSearchs" placeholder="全部">
  15. <Option value="-1">全部</Option>
  16. <Option value="0">审核中</Option>
  17. <Option value="1">已通过</Option>
  18. <Option value="2">未通过</Option>
  19. </Select>
  20. </FormItem>
  21. <Button type="primary" @click="userSearchs" class="ml20">查询</Button>
  22. <Button @click="reset" class="ml20">重置</Button>
  23. </div>
  24. </Form>
  25. </Card>
  26. <Card :bordered="false" dis-hover class="mt15">
  27. <Table row-key="id" :load-data="handleLoadData" :columns="columns1" :data="orderList" update-show-children>
  28. <template slot-scope="{ row, index }" slot="action">
  29. <a v-if="row.hasOwnProperty('level') && row.level < 4" @click="add(row.id)">添加</a>
  30. <Divider v-if="row.hasOwnProperty('level') && row.level < 4" type="vertical" />
  31. <a @click="edit(row.id)">编辑</a>
  32. <Divider v-if="!row.hasOwnProperty('children')" type="vertical" />
  33. <a v-if="!row.hasOwnProperty('children')" @click="del(row, '删除城市', index)">删除</a>
  34. </template>
  35. </Table>
  36. <div class="acea-row row-right mt15">
  37. <Page :total="total" :current="orderData.page" show-elevator show-total @on-change="pageChange"
  38. :page-size="orderData.limit" />
  39. </div>
  40. </Card>
  41. </div>
  42. </template>
  43. <script>
  44. import {
  45. mapState
  46. } from "vuex";
  47. import userDetails from "@/components/userDetails/userDetails";
  48. import timeOptions from "@/utils/timeOptions";
  49. import util from "@/libs/util";
  50. import Setting from "@/setting";
  51. import exportExcel from "@/utils/newToExcel.js";
  52. import {
  53. cityApi
  54. } from "@/api/setting";
  55. import {
  56. order_statistics
  57. } from "@/api/order";
  58. export default {
  59. name: "index",
  60. components: {
  61. userDetails,
  62. },
  63. data() {
  64. return {
  65. columns1: [{
  66. title: "编号",
  67. key: "id",
  68. width: 80,
  69. },
  70. {
  71. title: "地区名称",
  72. key: "label",
  73. minWidth: 300,
  74. tree: true
  75. },
  76. {
  77. title: "订单量",
  78. key: "count",
  79. minWidth: 100,
  80. },
  81. {
  82. title: "销售额",
  83. key: "total_price",
  84. minWidth: 120,
  85. },
  86. {
  87. title: "上级名称",
  88. key: "parent_name",
  89. minWidth: 100,
  90. },
  91. {
  92. title: "操作",
  93. slot: "action",
  94. // fixed: "right",
  95. minWidth: 120,
  96. },
  97. ],
  98. showSend: false, //显示审核弹窗
  99. isAll: 0,
  100. isCheckBox: false,
  101. checkUidList: [],
  102. timeVal: [],
  103. options: timeOptions,
  104. // 订单列表
  105. orderData: {
  106. page: 1,
  107. limit: 10,
  108. status: "1",
  109. start_time: "",
  110. end_time: "",
  111. parent_id:""
  112. },
  113. orderList: [],
  114. total: 0,
  115. loading: false,
  116. };
  117. },
  118. watch: {
  119. $route() {
  120. if (this.$route.fullPath === `${Setting.roterPre}/order/list?type=7&status=1`) {
  121. this.getPath();
  122. }
  123. }
  124. },
  125. computed: {
  126. ...mapState("store/layout", ["isMobile"]),
  127. labelWidth() {
  128. return this.isMobile ? undefined : 80;
  129. },
  130. labelPosition() {
  131. return this.isMobile ? "top" : "right";
  132. },
  133. },
  134. created() {
  135. if (this.$route.fullPath === `${Setting.roterPre}/order/list?type=7&status=1`) {
  136. this.getPath();
  137. } else {
  138. this.getList();
  139. }
  140. let data = {
  141. pid: 0
  142. }
  143. this.cityInfo(data);
  144. },
  145. mounted() {},
  146. methods: {
  147. // 查看更多订单信息
  148. handleLoadData(item, callback) {
  149. item._loading = true;
  150. let pushData = Object.assign({},this.orderData);
  151. pushData.parent_id = item.id;
  152. order_statistics(pushData).then(res => {
  153. item._loading = false;
  154. callback(res.data);
  155. }).catch(err => {
  156. this.loading = false;
  157. this.$Message.error(err.msg)
  158. })
  159. },
  160. //跳转刷新
  161. getPath() {
  162. this.orderData.page = 1;
  163. this.orderData.status = this.$route.query.status;
  164. this.getList();
  165. },
  166. allReset() {
  167. this.isAll = 0;
  168. this.isCheckBox = false;
  169. this.$refs.xTable.setAllCheckboxRow(false);
  170. this.checkUidList = [];
  171. },
  172. allPages(e) {
  173. this.isAll = e;
  174. if (e == 0) {
  175. this.$refs.xTable.toggleAllCheckboxRow();
  176. // this.checkboxAll();
  177. } else {
  178. if (!this.isCheckBox) {
  179. this.$refs.xTable.setAllCheckboxRow(true);
  180. this.isCheckBox = true;
  181. this.isAll = 1;
  182. } else {
  183. this.$refs.xTable.setAllCheckboxRow(false);
  184. this.isCheckBox = false;
  185. this.isAll = 0;
  186. }
  187. this.checkUidList = []
  188. }
  189. },
  190. reset() {
  191. this.timeVal = [];
  192. this.orderData = {
  193. page: 1,
  194. limit: 10,
  195. status: "1",
  196. start_time: "",
  197. end_time: "",
  198. parent_id:""
  199. };
  200. this.getList();
  201. },
  202. getList(id) {
  203. this.loading = true;
  204. if(id){
  205. this.orderData.parent_id = id;
  206. }else{
  207. this.orderData.parent_id = '';
  208. }
  209. order_statistics(this.orderData).then(res => {
  210. let data = res.data;
  211. this.$set(this, 'orderList', data);
  212. this.total = 31;
  213. this.loading = false;
  214. }).catch(err => {
  215. this.loading = false;
  216. this.$Message.error(err.msg)
  217. })
  218. },
  219. // 具体日期
  220. onchangeTime(e) {
  221. if (e[1].slice(-8) === "00:00:00") {
  222. e[1] = e[1].slice(0, -8) + "23:59:59";
  223. this.timeVal = e;
  224. } else {
  225. this.timeVal = e;
  226. }
  227. this.orderData.start_time = this.timeVal[0] || "";
  228. this.orderData.end_time = this.timeVal[1] || "";
  229. this.orderData.page = 1;
  230. this.allReset();
  231. this.getList();
  232. },
  233. pageChange(index) {
  234. this.orderData.page = index;
  235. this.getList();
  236. },
  237. userSearchs() {
  238. this.allReset();
  239. this.orderData.page = 1;
  240. this.getList();
  241. }
  242. },
  243. };
  244. </script>
  245. <style lang="stylus" scoped>
  246. .tdinfo {
  247. margin-left: 75px;
  248. margin-top: 16px;
  249. }
  250. .expand-row {
  251. margin-bottom: 16px;
  252. font-size: 12px;
  253. }
  254. .tabBox {
  255. width: 100%;
  256. height: 100%;
  257. display: flex;
  258. align-items: center;
  259. .alert_img {
  260. width: 300px;
  261. height: 300px;
  262. img {
  263. width: 100%;
  264. height: 100%;
  265. }
  266. }
  267. .tabBox_img {
  268. width: 30px;
  269. height: 30px;
  270. img {
  271. width: 100%;
  272. height: 100%;
  273. }
  274. }
  275. .tabBox_tit {
  276. width: 267px;
  277. height: 30px;
  278. line-height: 30px;
  279. font-size: 12px !important;
  280. margin: 0 2px 0 10px;
  281. letter-spacing: 1px;
  282. box-sizing: border-box;
  283. }
  284. }
  285. .tabBox+.tabBox {
  286. margin-top: 5px;
  287. }
  288. </style>