list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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.is_explode == 0"
  64. @click="handleSet(row, index, 1)"
  65. >下拆单</a
  66. >
  67. <a
  68. style="margin: 0 5px"
  69. :disabled="row.deep_status == 2"
  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.deep_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
  142. @click="handleProcess"
  143. :disabled="throttle_control"
  144. type="primary"
  145. style="margin-right: 10px"
  146. >确定</Button
  147. >
  148. </div>
  149. </Modal>
  150. </div>
  151. </template>
  152. <script>
  153. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  154. // 例如:import 《组件名称》 from '《组件路径》';
  155. export default {
  156. name: "BidSystemContractList",
  157. data() {
  158. // 这里存放数据
  159. return {
  160. throttle_control: false,
  161. tableColums: [
  162. {
  163. type: "selection",
  164. align: "center",
  165. key: "selection",
  166. minWidth: 100,
  167. fixed: "left",
  168. title: "全选",
  169. },
  170. { title: "订单号", align: "center", key: "order_no", minWidth: 150 },
  171. {
  172. title: "项目名称",
  173. align: "center",
  174. key: "residential_name",
  175. minWidth: 120,
  176. },
  177. { title: "详细地址", align: "center", key: "address", minWidth: 200 },
  178. // {
  179. // title: '订单类型', align: 'center', key: 'renovation_type', minWidth: 100,
  180. // render: (h, params) => h('span', {}, params.row.renovation_type == 1 ? '工装' : '家装')
  181. // },
  182. {
  183. title: "客户姓名",
  184. align: "center",
  185. key: "client_name",
  186. minWidth: 120,
  187. },
  188. { title: "手机号", align: "center", key: "mobile", minWidth: 150 },
  189. {
  190. title: "紧急程度",
  191. align: "center",
  192. key: "warning_state",
  193. minWidth: 100,
  194. slot: "basicTypeSet",
  195. },
  196. {
  197. title: "收款",
  198. align: "center",
  199. key: "pay_state",
  200. minWidth: 80,
  201. render: (h, params) =>
  202. h("span", {}, params.row.pay_state == 1 ? "已收款" : "未收款"),
  203. },
  204. { title: "业务员", align: "center", key: "salesman", minWidth: 100 },
  205. {
  206. title: "开始日期",
  207. align: "center",
  208. key: "start_time",
  209. minWidth: 150,
  210. render: (h, params) =>
  211. h("span", {}, this.func.replaceDateNoHMS(params.row.start_time)),
  212. },
  213. {
  214. title: "交付日期",
  215. align: "center",
  216. key: "end_time",
  217. minWidth: 150,
  218. render: (h, params) =>
  219. h("span", {}, this.func.replaceDateNoHMS(params.row.end_time)),
  220. },
  221. {
  222. title: "深化状态",
  223. align: "center",
  224. key: "deep_status",
  225. minWidth: 100,
  226. render: (h, params) =>
  227. h(
  228. "span",
  229. {},
  230. params.row.deep_status == 0
  231. ? "未深化"
  232. : params.row.deep_status == 1
  233. ? "深化中"
  234. : "深化完成"
  235. ),
  236. },
  237. {
  238. title: "下单日期",
  239. align: "center",
  240. key: "crt_time",
  241. minWidth: 200,
  242. render: (h, params) =>
  243. h("span", {}, this.func.replaceDate(params.row.crt_time)),
  244. },
  245. {
  246. title: "操作",
  247. align: "center",
  248. key: "set",
  249. slot: "set",
  250. fixed: "right",
  251. minWidth: 350,
  252. },
  253. ],
  254. tableData: [],
  255. page_index: 1,
  256. page_size: 10,
  257. total: 0,
  258. loading: false,
  259. proxyObj: {},
  260. headers: { Authorization: localStorage.getItem("token") },
  261. selects: [],
  262. processModal: false,
  263. process_man: "",
  264. processManList: [],
  265. process_start_time: "",
  266. process_end_time: "",
  267. order_no: "",
  268. warningList: [],
  269. oa_id: "",
  270. };
  271. },
  272. // 生命周期 - 创建完成(可以访问当前this实例)
  273. created() {
  274. // 获取紧急程度
  275. this.axios.get("/api/warning_list").then((res) => {
  276. this.warningList = res.data.data;
  277. });
  278. // 获取用户列表
  279. this.axios({ method: "get", url: "/api/user" }).then((res) => {
  280. this.processManList = res.data.data;
  281. });
  282. },
  283. // 生命周期 - 挂载完成(可以访问DOM元素)
  284. mounted() {},
  285. methods: {
  286. handleProcess() {
  287. this.throttle_control = true;
  288. if (
  289. this.process_man &&
  290. this.process_end_time &&
  291. this.process_start_time
  292. ) {
  293. this.axios({
  294. method: "get",
  295. url: "/api/order_area_pull",
  296. params: {
  297. order_no: this.order_no,
  298. oa_id: this.oa_id,
  299. sub_status: 2,
  300. process_man: this.process_man,
  301. process_start_time: this.func.replaceDateNoHMS(
  302. this.process_start_time
  303. ),
  304. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  305. },
  306. }).then((res) => {
  307. this.$Message.success(res.msg);
  308. this.processModal = false;
  309. this.getData(this.proxyObj);
  310. this.throttle_control = false;
  311. });
  312. } else {
  313. this.throttle_control = false;
  314. this.$Message.warning("信息请填写完整");
  315. }
  316. },
  317. //1下拆单 2编辑 3详情 4变更 5变更记录 6数据对比
  318. handleSet(row, index, type) {
  319. switch (type) {
  320. case 1:
  321. this.processModal = true;
  322. this.order_no = row.order_no;
  323. this.oa_id = row.oa_id;
  324. // this.$Modal.confirm({
  325. // title: '确认拆单?',
  326. // content: '确认后订单将下至拆单,请确认!',
  327. // onOk: () => {
  328. // this.axios({
  329. // method: 'get',
  330. // url: '/api/order_area_pull',
  331. // params: {
  332. // order_no: row.order_no,
  333. // sub_status:2
  334. // }
  335. // }).then((res) => {
  336. // this.$Message.success(res.msg)
  337. // this.getData(this.proxyObj)
  338. // }).catch((err) => {
  339. // });
  340. // },
  341. // onCancel: () => {}
  342. // })
  343. break;
  344. // 转详情页
  345. case 2:
  346. this.$router.push({
  347. path: "/cms/BidSystem/DeepeningOrder/detail",
  348. query: {
  349. type,
  350. order_no: row.order_no,
  351. oa_id: row.oa_id,
  352. },
  353. });
  354. break;
  355. case 3:
  356. this.$router.push({
  357. path: "/cms/BidSystem/DeepeningOrder/info",
  358. query: {
  359. type,
  360. order_no: row.order_no,
  361. oa_id: row.oa_id,
  362. },
  363. });
  364. break;
  365. case 4:
  366. this.$router.push({
  367. path: "/cms/BidSystem/DeepeningOrder/change",
  368. query: {
  369. type,
  370. order_no: row.order_no,
  371. oa_id: row.oa_id,
  372. },
  373. });
  374. break;
  375. case 5:
  376. this.$router.push({
  377. path: "/cms/BidSystem/DeepeningOrder/changeRecord",
  378. query: {
  379. type,
  380. order_no: row.order_no,
  381. oa_id: row.oa_id,
  382. },
  383. });
  384. break;
  385. case 6:
  386. this.$router.push({
  387. path: "/cms/BidSystem/DeepeningOrder/compare",
  388. query: {
  389. type,
  390. order_no: row.order_no,
  391. },
  392. });
  393. break;
  394. }
  395. },
  396. init(row) {
  397. this.page_index = 1;
  398. //1 深化 换接口 弃用
  399. // row.sub_status = 1;
  400. row.page_index = this.page_index;
  401. row.page_size = this.page_size;
  402. this.proxyObj = row;
  403. this.getData(row);
  404. },
  405. getData(row) {
  406. this.loading = true;
  407. this.axios("/api/order_area_deep_list", { params: row }).then((res) => {
  408. console.log(res.data);
  409. this.loading = false;
  410. this.tableData = res.data.data;
  411. this.total = res.data.total;
  412. this.tableheaders = res.data.tableSet || [];
  413. });
  414. },
  415. throttle(delay) {
  416. this.throttle_control = true;
  417. setTimeout(() => {
  418. this.handleProcess();
  419. }, delay);
  420. },
  421. changePage(e) {
  422. this.page_index = e;
  423. this.proxyObj.page_index = this.page_index;
  424. this.getData(this.proxyObj);
  425. },
  426. changeSize(e) {
  427. this.page_size = e;
  428. this.proxyObj.page_size = this.page_size;
  429. this.getData(this.proxyObj);
  430. },
  431. async exportData() {
  432. const res = await this.axios("/api/measure_orders_export", {
  433. params: { ...this.proxyObj },
  434. });
  435. if (res.code == 200) {
  436. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  437. location.href = url;
  438. }
  439. },
  440. uploadSuccess(res) {
  441. if (res.code == 200) {
  442. this.$Message.success(res.msg || "上传成功");
  443. } else {
  444. this.$Message.warning(res.msg || "上传失败");
  445. }
  446. this.getData(this.proxyObj);
  447. },
  448. uploadError(err) {
  449. this.$Message.error(err.msg || "上传失败");
  450. },
  451. selectTable(e) {
  452. this.selects = e;
  453. },
  454. },
  455. // 监听属性 类似于data概念
  456. computed: {
  457. set_list() {
  458. return [
  459. {
  460. title: "订单编号",
  461. serverName: "order_no",
  462. name: "Input",
  463. value: "",
  464. placeholder: "请输入订单号",
  465. },
  466. {
  467. title: "项目名称",
  468. name: "Input",
  469. placeholder: "请输入",
  470. value: "",
  471. serverName: "residential_name",
  472. },
  473. {
  474. title: "客户昵称",
  475. name: "Input",
  476. placeholder: "请输入",
  477. value: "",
  478. serverName: "client_name",
  479. },
  480. {
  481. title: "手机号",
  482. name: "Input",
  483. placeholder: "请输入",
  484. value: "",
  485. serverName: "mobile",
  486. },
  487. {
  488. title: "深化状态",
  489. name: "Select",
  490. placeholder: "请选择",
  491. serverName: "deep_status",
  492. value: 99,
  493. option: [
  494. { label: "未深化", value: 0 },
  495. { label: "深化中", value: 1 },
  496. { label: "深化完成", value: 2 },
  497. ],
  498. },
  499. {
  500. title: "紧急程度",
  501. name: "Select",
  502. serverName: "warning_state",
  503. placeholder: "请选择",
  504. value: "",
  505. optionName: "title",
  506. optionValue: "id",
  507. option: this.warningList,
  508. },
  509. ];
  510. },
  511. },
  512. // 监控data中的数据变化
  513. watch: {},
  514. beforeCreate() {}, // 生命周期 - 创建之前
  515. beforeMount() {}, // 生命周期 - 挂载之前
  516. beforeUpdate() {}, // 生命周期 - 更新之前
  517. updated() {}, // 生命周期 - 更新之后
  518. beforeDestroy() {}, // 生命周期 - 销毁之前
  519. destroyed() {}, // 生命周期 - 销毁完成
  520. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  521. };
  522. </script>
  523. <style lang="scss" scoped>
  524. .pageSlotStyle {
  525. display: flex;
  526. justify-content: center;
  527. margin-top: 40px;
  528. }
  529. .process_modal {
  530. display: flex;
  531. justify-content: center;
  532. align-items: center;
  533. padding: 10px;
  534. }
  535. </style>