list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <div class="BidsList">
  3. <FullPage
  4. title="深化单"
  5. :list="set_list"
  6. @init="init"
  7. :loading="loading"
  8. @searchData="init"
  9. @selectTable="selectTable"
  10. @changePage="changePage"
  11. @changeSize="changeSize"
  12. :tableColums="tableColums"
  13. :showPage="false"
  14. :tableData="tableData"
  15. :page_index="page_index"
  16. :total="total"
  17. >
  18. <div slot="titleButton" style="display: flex">
  19. <Upload
  20. name="your_file"
  21. :show-upload-list="false"
  22. :headers="headers"
  23. :on-error="uploadError"
  24. :on-success="uploadSuccess"
  25. :action="$store.state.ip + '/api/order_area_product_import'"
  26. >
  27. <Button type="success" ghost icon="md-exit" style="margin-right: 10px"
  28. >导入</Button
  29. >
  30. </Upload>
  31. <Button
  32. @click="exportData"
  33. type="warning"
  34. ghost
  35. icon="md-return-left"
  36. style="margin-right: 10px"
  37. >导出</Button
  38. >
  39. </div>
  40. <!-- <div slot='navButton'
  41. style="display:flex;">
  42. <Button v-if='persimissionData["表头设置"]||persimissionData.all'
  43. @click="setupTableHeader"
  44. type="primary"
  45. ghost
  46. icon='ios-cog'>表头设置</Button>
  47. </div> -->
  48. <template slot="basicTypeSet" slot-scope="{ row }">
  49. <div>
  50. <span
  51. v-for="item in warningList"
  52. :key="item.id"
  53. :style="{ color: item.color }"
  54. v-show="item.id == row.warning_state"
  55. >{{ item.title }}</span
  56. >
  57. </div>
  58. </template>
  59. <template slot="set" slot-scope="{ row, index }">
  60. <div>
  61. <a
  62. style="margin: 0 5px"
  63. :disabled="row.sub_status != 1"
  64. @click="handleSet(row, index, 1)"
  65. >下拆单</a
  66. >
  67. <a
  68. style="margin: 0 5px"
  69. :disabled="row.sub_status != 1"
  70. @click="handleSet(row, index, 2)"
  71. >编辑</a
  72. >
  73. <a style="margin: 0 5px" @click="handleSet(row, index, 3)">详情</a>
  74. <a
  75. style="margin: 0 5px"
  76. :disabled="row.sub_status != 1"
  77. @click="handleSet(row, index, 4)"
  78. >变更</a
  79. >
  80. <a
  81. style="margin: 0 5px; color: orange"
  82. @click="handleSet(row, index, 5)"
  83. >变更记录</a
  84. >
  85. <a style="margin: 0 5px" @click="handleSet(row, index, 6)"
  86. >数据对比</a
  87. >
  88. </div>
  89. </template>
  90. <template slot="pageSlot">
  91. <div class="pageSlotStyle">
  92. <Page
  93. :page-size-opts="[10, 20, 30, 40, 100, 1000]"
  94. @on-page-size-change="changeSize"
  95. @on-change="changePage"
  96. :current="page_index"
  97. show-total
  98. :total="total"
  99. show-sizer
  100. :page-size="page_size"
  101. />
  102. </div>
  103. </template>
  104. </FullPage>
  105. <Modal v-model="processModal" title="确认?">
  106. <div>
  107. <div class="process_modal">
  108. <span>拆单人员:</span>
  109. <Select v-model="process_man" style="width: 150px">
  110. <Option
  111. v-for="item in processManList"
  112. :key="item.id"
  113. :label="item.nickname"
  114. :value="item.id"
  115. ></Option>
  116. </Select>
  117. </div>
  118. <div class="process_modal">
  119. <span>选择时间:</span>
  120. <DatePicker
  121. type="date"
  122. v-model="process_start_time"
  123. placeholder="年/月/日"
  124. style="width: 150px"
  125. ></DatePicker>
  126. <DatePicker
  127. type="date"
  128. v-model="process_end_time"
  129. placeholder="年/月/日"
  130. style="width: 150px"
  131. ></DatePicker>
  132. </div>
  133. </div>
  134. <div slot="footer">
  135. <Button
  136. @click="processModal = false"
  137. type="primary"
  138. style="margin-right: 10px"
  139. >取消</Button
  140. >
  141. <Button @click="handleProcess" type="primary" style="margin-right: 10px"
  142. >确定</Button
  143. >
  144. </div>
  145. </Modal>
  146. </div>
  147. </template>
  148. <script>
  149. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  150. // 例如:import 《组件名称》 from '《组件路径》';
  151. export default {
  152. name: "BidSystemContractList",
  153. data() {
  154. // 这里存放数据
  155. return {
  156. tableColums: [
  157. {
  158. type: "selection",
  159. align: "center",
  160. key: "selection",
  161. minWidth: 100,
  162. fixed: "left",
  163. title: "全选",
  164. },
  165. { title: "订单号", align: "center", key: "order_no", minWidth: 150 },
  166. {
  167. title: "小区名称",
  168. align: "center",
  169. key: "residential_name",
  170. minWidth: 120,
  171. },
  172. { title: "详细地址", align: "center", key: "address", minWidth: 200 },
  173. // {
  174. // title: '订单类型', align: 'center', key: 'renovation_type', minWidth: 100,
  175. // render: (h, params) => h('span', {}, params.row.renovation_type == 1 ? '工装' : '家装')
  176. // },
  177. {
  178. title: "客户姓名",
  179. align: "center",
  180. key: "client_name",
  181. minWidth: 120,
  182. },
  183. { title: "手机号", align: "center", key: "mobile", minWidth: 150 },
  184. {
  185. title: "紧急程度",
  186. align: "center",
  187. key: "warning_state",
  188. minWidth: 100,
  189. slot: "basicTypeSet",
  190. },
  191. {
  192. title: "收款",
  193. align: "center",
  194. key: "pay_state",
  195. minWidth: 80,
  196. render: (h, params) =>
  197. h("span", {}, params.row.pay_state == 1 ? "已收款" : "未收款"),
  198. },
  199. { title: "业务员", align: "center", key: "salesman", minWidth: 100 },
  200. {
  201. title: "开始日期",
  202. align: "center",
  203. key: "start_time",
  204. minWidth: 150,
  205. render: (h, params) =>
  206. h("span", {}, this.func.replaceDateNoHMS(params.row.start_time)),
  207. },
  208. {
  209. title: "交付日期",
  210. align: "center",
  211. key: "end_time",
  212. minWidth: 150,
  213. render: (h, params) =>
  214. h("span", {}, this.func.replaceDateNoHMS(params.row.end_time)),
  215. },
  216. {
  217. title: "订单状态",
  218. align: "center",
  219. key: "state",
  220. minWidth: 100,
  221. render: (h, params) =>
  222. h(
  223. "span",
  224. {},
  225. params.row.state == 0
  226. ? "待审核"
  227. : params.row.warning_state == 1
  228. ? "待拆单"
  229. : params.row.warning_state == 2
  230. ? "待生产"
  231. : "已完成"
  232. ),
  233. },
  234. {
  235. title: "下单日期",
  236. align: "center",
  237. key: "crt_time",
  238. minWidth: 150,
  239. render: (h, params) =>
  240. h("span", {}, this.func.replaceDateNoHMS(params.row.crt_time)),
  241. },
  242. {
  243. title: "操作",
  244. align: "center",
  245. key: "set",
  246. slot: "set",
  247. fixed: "right",
  248. minWidth: 350,
  249. fixed: "right",
  250. },
  251. ],
  252. tableData: [],
  253. page_index: 1,
  254. page_size: 10,
  255. total: 0,
  256. loading: false,
  257. proxyObj: {},
  258. headers: { Authorization: localStorage.getItem("token") },
  259. selects: [],
  260. processModal: false,
  261. process_man: "",
  262. processManList: [],
  263. process_start_time: "",
  264. process_end_time: "",
  265. order_no: "",
  266. warningList: [],
  267. };
  268. },
  269. // 生命周期 - 创建完成(可以访问当前this实例)
  270. created() {
  271. // 获取紧急程度
  272. this.axios.get("/api/warning_list").then((res) => {
  273. this.warningList = res.data.data;
  274. });
  275. // 获取用户列表
  276. this.axios({ method: "get", url: "/api/user" }).then((res) => {
  277. this.processManList = res.data.data;
  278. });
  279. },
  280. // 生命周期 - 挂载完成(可以访问DOM元素)
  281. mounted() {},
  282. methods: {
  283. handleProcess() {
  284. if (
  285. this.process_man &&
  286. this.process_end_time &&
  287. this.process_start_time
  288. ) {
  289. this.axios({
  290. method: "get",
  291. url: "/api/order_area_pull",
  292. params: {
  293. order_no: this.order_no,
  294. sub_status: 2,
  295. process_man: this.process_man,
  296. process_start_time: this.func.replaceDateNoHMS(
  297. this.process_start_time
  298. ),
  299. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  300. },
  301. }).then((res) => {
  302. this.$Message.success(res.msg);
  303. this.getData(this.proxyObj);
  304. });
  305. } else {
  306. this.$Message.warning("信息请填写完整");
  307. }
  308. },
  309. //1下拆单 2编辑 3详情 4变更 5变更记录 6数据对比
  310. handleSet(row, index, type) {
  311. switch (type) {
  312. case 1:
  313. this.processModal = true;
  314. this.order_no = row.order_no;
  315. // this.$Modal.confirm({
  316. // title: '确认拆单?',
  317. // content: '确认后订单将下至拆单,请确认!',
  318. // onOk: () => {
  319. // this.axios({
  320. // method: 'get',
  321. // url: '/api/order_area_pull',
  322. // params: {
  323. // order_no: row.order_no,
  324. // sub_status:2
  325. // }
  326. // }).then((res) => {
  327. // this.$Message.success(res.msg)
  328. // this.getData(this.proxyObj)
  329. // }).catch((err) => {
  330. // });
  331. // },
  332. // onCancel: () => {}
  333. // })
  334. break;
  335. // 转详情页
  336. case 2:
  337. case 3:
  338. this.$router.push({
  339. path: "/cms/BidSystem/DeepeningOrder/detail",
  340. query: {
  341. type,
  342. order_no: row.order_no,
  343. },
  344. });
  345. break;
  346. case 4:
  347. break;
  348. case 5:
  349. break;
  350. case 6:
  351. this.$router.push({
  352. path: "/cms/BidSystem/DeepeningOrder/compare",
  353. query: {
  354. type,
  355. order_no: row.order_no,
  356. },
  357. });
  358. break;
  359. }
  360. },
  361. init(row) {
  362. this.page_index = 1;
  363. //1 深化
  364. row.sub_status = 1;
  365. row.page_index = this.page_index;
  366. row.page_size = this.page_size;
  367. this.proxyObj = row;
  368. this.getData(row);
  369. },
  370. getData(row) {
  371. this.loading = true;
  372. this.axios("/api/order_area", { params: row }).then((res) => {
  373. this.loading = false;
  374. this.tableData = res.data.data;
  375. this.total = res.data.total;
  376. this.tableheaders = res.data.tableSet || [];
  377. });
  378. },
  379. changePage(e) {
  380. this.page_index = e;
  381. this.proxyObj.page_index = this.page_index;
  382. this.getData(this.proxyObj);
  383. },
  384. changeSize(e) {
  385. this.page_size = e;
  386. this.proxyObj.page_size = this.page_size;
  387. this.getData(this.proxyObj);
  388. },
  389. async exportData() {
  390. const res = await this.axios("/api/measure_orders_export", {
  391. params: { ...this.proxyObj },
  392. });
  393. if (res.code == 200) {
  394. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  395. location.href = url;
  396. }
  397. },
  398. uploadSuccess(res) {
  399. if (res.code == 200) {
  400. this.$Message.success(res.msg || "上传成功");
  401. } else {
  402. this.$Message.warning(res.msg || "上传失败");
  403. }
  404. this.getData(this.proxyObj);
  405. },
  406. uploadError(err) {
  407. this.$Message.error(err.msg || "上传失败");
  408. },
  409. selectTable(e) {
  410. this.selects = e;
  411. },
  412. },
  413. // 监听属性 类似于data概念
  414. computed: {
  415. set_list() {
  416. return [
  417. {
  418. title: "订单编号",
  419. serverName: "order_no",
  420. name: "Input",
  421. value: "",
  422. placeholder: "请输入订单号",
  423. },
  424. {
  425. title: "小区名字",
  426. name: "Input",
  427. placeholder: "请输入",
  428. value: "",
  429. serverName: "residential_name",
  430. },
  431. {
  432. title: "客户昵称",
  433. name: "Input",
  434. placeholder: "请输入",
  435. value: "",
  436. serverName: "client_name",
  437. },
  438. {
  439. title: "手机号",
  440. name: "Input",
  441. placeholder: "请输入",
  442. value: "",
  443. serverName: "mobile",
  444. },
  445. {
  446. title: "订单状态",
  447. name: "Select",
  448. placeholder: "请选择",
  449. serverName: "state",
  450. value: "",
  451. option: [
  452. { label: "待审核", value: 0 },
  453. { label: "待拆单", value: 1 },
  454. { label: "待生产", value: 2 },
  455. { label: "已完成", value: 3 },
  456. ],
  457. },
  458. {
  459. title: "紧急程度",
  460. name: "Select",
  461. serverName: "warning_state",
  462. placeholder: "请选择",
  463. value: "",
  464. optionName: "title",
  465. optionValue: "id",
  466. option: this.warningList,
  467. },
  468. ];
  469. },
  470. },
  471. // 监控data中的数据变化
  472. watch: {},
  473. beforeCreate() {}, // 生命周期 - 创建之前
  474. beforeMount() {}, // 生命周期 - 挂载之前
  475. beforeUpdate() {}, // 生命周期 - 更新之前
  476. updated() {}, // 生命周期 - 更新之后
  477. beforeDestroy() {}, // 生命周期 - 销毁之前
  478. destroyed() {}, // 生命周期 - 销毁完成
  479. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  480. };
  481. </script>
  482. <style lang='scss' scoped>
  483. .pageSlotStyle {
  484. display: flex;
  485. justify-content: center;
  486. margin-top: 40px;
  487. }
  488. .process_modal {
  489. display: flex;
  490. justify-content: center;
  491. align-items: center;
  492. padding: 10px;
  493. }
  494. </style>