list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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 @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: "deep_status",
  220. minWidth: 100,
  221. render: (h, params) =>
  222. h(
  223. "span",
  224. {},
  225. params.row.deep_status == 0
  226. ? "未深化"
  227. : params.row.deep_status == 1
  228. ? "深化中"
  229. : "深化完成"
  230. ),
  231. },
  232. {
  233. title: "下单日期",
  234. align: "center",
  235. key: "crt_time",
  236. minWidth: 150,
  237. render: (h, params) =>
  238. h("span", {}, this.func.replaceDateNoHMS(params.row.crt_time)),
  239. },
  240. {
  241. title: "操作",
  242. align: "center",
  243. key: "set",
  244. slot: "set",
  245. fixed: "right",
  246. minWidth: 350,
  247. },
  248. ],
  249. tableData: [],
  250. page_index: 1,
  251. page_size: 10,
  252. total: 0,
  253. loading: false,
  254. proxyObj: {},
  255. headers: { Authorization: localStorage.getItem("token") },
  256. selects: [],
  257. processModal: false,
  258. process_man: "",
  259. processManList: [],
  260. process_start_time: "",
  261. process_end_time: "",
  262. order_no: "",
  263. warningList: [],
  264. oa_id:''
  265. };
  266. },
  267. // 生命周期 - 创建完成(可以访问当前this实例)
  268. created() {
  269. // 获取紧急程度
  270. this.axios.get("/api/warning_list").then((res) => {
  271. this.warningList = res.data.data;
  272. });
  273. // 获取用户列表
  274. this.axios({ method: "get", url: "/api/user" }).then((res) => {
  275. this.processManList = res.data.data;
  276. });
  277. },
  278. // 生命周期 - 挂载完成(可以访问DOM元素)
  279. mounted() {},
  280. methods: {
  281. handleProcess() {
  282. if (
  283. this.process_man &&
  284. this.process_end_time &&
  285. this.process_start_time
  286. ) {
  287. this.axios({
  288. method: "get",
  289. url: "/api/order_area_pull",
  290. params: {
  291. order_no: this.order_no,
  292. oa_id: this.oa_id,
  293. sub_status: 2,
  294. process_man: this.process_man,
  295. process_start_time: this.func.replaceDateNoHMS(
  296. this.process_start_time
  297. ),
  298. process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
  299. },
  300. }).then((res) => {
  301. this.$Message.success(res.msg);
  302. this.processModal = false;
  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.oa_id = row.oa_id;
  316. // this.$Modal.confirm({
  317. // title: '确认拆单?',
  318. // content: '确认后订单将下至拆单,请确认!',
  319. // onOk: () => {
  320. // this.axios({
  321. // method: 'get',
  322. // url: '/api/order_area_pull',
  323. // params: {
  324. // order_no: row.order_no,
  325. // sub_status:2
  326. // }
  327. // }).then((res) => {
  328. // this.$Message.success(res.msg)
  329. // this.getData(this.proxyObj)
  330. // }).catch((err) => {
  331. // });
  332. // },
  333. // onCancel: () => {}
  334. // })
  335. break;
  336. // 转详情页
  337. case 2:
  338. this.$router.push({
  339. path: "/cms/BidSystem/DeepeningOrder/detail",
  340. query: {
  341. type,
  342. order_no: row.order_no,
  343. oa_id: row.oa_id,
  344. },
  345. });
  346. break;
  347. case 3:
  348. this.$router.push({
  349. path: "/cms/BidSystem/DeepeningOrder/info",
  350. query: {
  351. type,
  352. order_no: row.order_no,
  353. oa_id: row.oa_id,
  354. },
  355. });
  356. break;
  357. case 4:
  358. break;
  359. case 5:
  360. break;
  361. case 6:
  362. this.$router.push({
  363. path: "/cms/BidSystem/DeepeningOrder/compare",
  364. query: {
  365. type,
  366. order_no: row.order_no,
  367. },
  368. });
  369. break;
  370. }
  371. },
  372. init(row) {
  373. this.page_index = 1;
  374. //1 深化 换接口 弃用
  375. // row.sub_status = 1;
  376. if (!row.deep_status && row.deep_status != 0) {
  377. row.deep_status = 99;
  378. }
  379. row.page_index = this.page_index;
  380. row.page_size = this.page_size;
  381. this.proxyObj = row;
  382. this.getData(row);
  383. },
  384. getData(row) {
  385. this.loading = true;
  386. this.axios("/api/order_area_deep_list", { params: row }).then((res) => {
  387. console.log(res.data)
  388. this.loading = false;
  389. this.tableData = res.data.data;
  390. this.total = res.data.total;
  391. this.tableheaders = res.data.tableSet || [];
  392. });
  393. },
  394. changePage(e) {
  395. this.page_index = e;
  396. this.proxyObj.page_index = this.page_index;
  397. this.getData(this.proxyObj);
  398. },
  399. changeSize(e) {
  400. this.page_size = e;
  401. this.proxyObj.page_size = this.page_size;
  402. this.getData(this.proxyObj);
  403. },
  404. async exportData() {
  405. const res = await this.axios("/api/measure_orders_export", {
  406. params: { ...this.proxyObj },
  407. });
  408. if (res.code == 200) {
  409. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  410. location.href = url;
  411. }
  412. },
  413. uploadSuccess(res) {
  414. if (res.code == 200) {
  415. this.$Message.success(res.msg || "上传成功");
  416. } else {
  417. this.$Message.warning(res.msg || "上传失败");
  418. }
  419. this.getData(this.proxyObj);
  420. },
  421. uploadError(err) {
  422. this.$Message.error(err.msg || "上传失败");
  423. },
  424. selectTable(e) {
  425. this.selects = e;
  426. },
  427. },
  428. // 监听属性 类似于data概念
  429. computed: {
  430. set_list() {
  431. return [
  432. {
  433. title: "订单编号",
  434. serverName: "order_no",
  435. name: "Input",
  436. value: "",
  437. placeholder: "请输入订单号",
  438. },
  439. {
  440. title: "项目名称",
  441. name: "Input",
  442. placeholder: "请输入",
  443. value: "",
  444. serverName: "residential_name",
  445. },
  446. {
  447. title: "客户昵称",
  448. name: "Input",
  449. placeholder: "请输入",
  450. value: "",
  451. serverName: "client_name",
  452. },
  453. {
  454. title: "手机号",
  455. name: "Input",
  456. placeholder: "请输入",
  457. value: "",
  458. serverName: "mobile",
  459. },
  460. {
  461. title: "深化状态",
  462. name: "Select",
  463. placeholder: "请选择",
  464. serverName: "deep_status",
  465. value: 99,
  466. option: [
  467. { label: "未深化", value: 0 },
  468. { label: "深化中", value: 1 },
  469. { label: "深化完成", value: 2 },
  470. ],
  471. },
  472. {
  473. title: "紧急程度",
  474. name: "Select",
  475. serverName: "warning_state",
  476. placeholder: "请选择",
  477. value: "",
  478. optionName: "title",
  479. optionValue: "id",
  480. option: this.warningList,
  481. },
  482. ];
  483. },
  484. },
  485. // 监控data中的数据变化
  486. watch: {},
  487. beforeCreate() {}, // 生命周期 - 创建之前
  488. beforeMount() {}, // 生命周期 - 挂载之前
  489. beforeUpdate() {}, // 生命周期 - 更新之前
  490. updated() {}, // 生命周期 - 更新之后
  491. beforeDestroy() {}, // 生命周期 - 销毁之前
  492. destroyed() {}, // 生命周期 - 销毁完成
  493. activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
  494. };
  495. </script>
  496. <style lang="scss" scoped>
  497. .pageSlotStyle {
  498. display: flex;
  499. justify-content: center;
  500. margin-top: 40px;
  501. }
  502. .process_modal {
  503. display: flex;
  504. justify-content: center;
  505. align-items: center;
  506. padding: 10px;
  507. }
  508. </style>