index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <div class="consultOrder pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <ex-table
  7. v-loading="loading"
  8. :table="table"
  9. :data="tableData"
  10. :columns="columns"
  11. :page="pageInfo"
  12. :size="size"
  13. @page-curr-change="handlePageChange"
  14. @page-size-change="handleSizeChange"
  15. @screen-reset="
  16. pageInfo.curr = 1;
  17. parmValue.page = 1;
  18. searchList();
  19. "
  20. @screen-submit="
  21. pageInfo.curr = 1;
  22. parmValue.page = 1;
  23. searchList();
  24. "
  25. >
  26. <template #table-header="{}">
  27. <div style="width: 100%">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="24">
  30. <el-col :span="4" style="width: 120px">
  31. <el-select
  32. :size="searchSize"
  33. v-model="parmValue.zxtype"
  34. filterable
  35. clearable
  36. placeholder="咨询类型"
  37. style="width: 100%"
  38. @change="
  39. pageInfo.curr = 1;
  40. parmValue.page = 1;
  41. searchList();
  42. "
  43. >
  44. <el-option
  45. v-for="item in statusList"
  46. :key="'zxtype' + item"
  47. :label="iteme"
  48. :value="item"
  49. />
  50. </el-select>
  51. </el-col>
  52. <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
  53. <el-input
  54. :size="searchSize"
  55. v-model="parmValue.name"
  56. :maxlength="40"
  57. placeholder="业务员姓名"
  58. />
  59. </el-col>
  60. <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
  61. <el-input
  62. :size="searchSize"
  63. v-model="parmValue.username"
  64. :maxlength="40"
  65. placeholder="手机号"
  66. />
  67. </el-col>
  68. <el-col :span="4" style="width: 54px">
  69. <el-button
  70. :size="searchSize"
  71. type="primary"
  72. class="fr"
  73. icon="el-icon-search"
  74. @click="searchList"
  75. /></el-col>
  76. <el-col :span="4" style="width: 66px">
  77. <el-button
  78. type="warning"
  79. class="fr"
  80. :size="searchSize"
  81. @click="restSearch"
  82. >
  83. 重置
  84. </el-button>
  85. </el-col>
  86. <el-col :span="3" style="width: 66px; float: right">
  87. <el-button
  88. :size="searchSize"
  89. type="primary"
  90. style="float: right; margin-left: 5px"
  91. @click="searchList"
  92. >
  93. 刷新
  94. </el-button>
  95. </el-col>
  96. </el-col>
  97. </el-row>
  98. </div>
  99. </template>
  100. <template #status="{ scope }">
  101. <el-tag
  102. :size="tablebtnSize"
  103. :type="scope.row.status == '0' ? 'warning' : ''"
  104. v-text="
  105. (statusOptions.find((item) => item.id == scope.row.status) || {})
  106. .label || '--'
  107. "
  108. ></el-tag>
  109. </template>
  110. <template #operation="{ scope }">
  111. <el-tooltip
  112. v-if="powers.some((item) => item == '007')"
  113. effect="dark"
  114. content="详情"
  115. placement="top"
  116. >
  117. <i
  118. class="el-icon-view tb-icon"
  119. @click="openModal(scope.row.id, true)"
  120. ></i>
  121. </el-tooltip>
  122. <el-tooltip
  123. v-if="powers.some((item) => item == '006')"
  124. effect="dark"
  125. content="删除"
  126. placement="top"
  127. >
  128. <i
  129. class="el-icon-delete tb-icon"
  130. @click="deleteById(scope.row.id, scope.row.status)"
  131. ></i>
  132. </el-tooltip>
  133. </template>
  134. </ex-table>
  135. <add-edit
  136. :id="modelId"
  137. :sitem="sitem"
  138. :show-model="showModel"
  139. :is-detail="isDetail"
  140. @refresh="searchList"
  141. @cancel="showModel = false"
  142. />
  143. </div>
  144. <div v-else>
  145. <no-auth></no-auth>
  146. </div>
  147. </div>
  148. </template>
  149. <script>
  150. import mixinPage from "@/mixins/elPaginationHandle";
  151. import resToken from "@/mixins/resToken";
  152. import addEdit from "./addEdit";
  153. import statusList from "@/assets/js/statusList";
  154. import asyncRequest from "@/apis/service/sellOut/consultOrder";
  155. import { mapGetters } from "vuex";
  156. export default {
  157. name: "consultOrder",
  158. mixins: [mixinPage, resToken],
  159. components: {
  160. addEdit,
  161. },
  162. computed: {
  163. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  164. powers() {
  165. let tran =
  166. this.$store.getters.btnList.find(
  167. (item) => item.menu_route == "consultOrder"
  168. ) || {};
  169. if (tran && tran.action && tran.action.length > 0) {
  170. return tran.action;
  171. } else {
  172. return [];
  173. }
  174. },
  175. },
  176. data() {
  177. return {
  178. sitem: null,
  179. // 状态
  180. statusOptions: [
  181. { id: "0", label: "禁用" },
  182. { id: "1", label: "启用" },
  183. ],
  184. statusList: statusList,
  185. loading: true,
  186. showModel: false,
  187. isDetail: false,
  188. modelId: 0,
  189. parmValue: {
  190. name: "", // 业务员名字
  191. username: "", // 账号
  192. status: "", //
  193. page: 1, // 页码
  194. size: 15, // 每页显示条数
  195. },
  196. tableData: [],
  197. passwordModel: false,
  198. passwordModelId: 0,
  199. isPasswordDetail: false,
  200. // 表格 - 数据
  201. tableData: [],
  202. // 表格 - 参数
  203. table: {
  204. stripe: true,
  205. border: true,
  206. _defaultHeader_: ["setcol"],
  207. },
  208. // 表格 - 分页
  209. pageInfo: {
  210. size: 15,
  211. curr: 1,
  212. total: 0,
  213. },
  214. // 表格 - 列参数
  215. columns: [
  216. {
  217. prop: "zxNo",
  218. label: "咨询单号",
  219. fixed: "left",
  220. width: "152px",
  221. },
  222. {
  223. prop: "salesman",
  224. label: "申请人",
  225. width: "60px",
  226. },
  227. {
  228. prop: "khNo",
  229. label: "客户公司编码",
  230. width: "125px",
  231. },
  232. {
  233. prop: "khname",
  234. label: "客户公司名称",
  235. "min-width": "160px",
  236. },
  237. {
  238. prop: "zxtype",
  239. label: "咨询类型",
  240. width: "85px",
  241. },
  242. {
  243. prop: "cpname",
  244. label: "产品名称",
  245. "min-width": "160px",
  246. },
  247. {
  248. prop: "unit",
  249. label: "单位",
  250. width: "45px",
  251. },
  252. {
  253. prop: "num",
  254. label: "需求数量",
  255. width: "80px",
  256. },
  257. {
  258. prop: "sale_price",
  259. label: "财务定价",
  260. width: "110px",
  261. },
  262. {
  263. prop: "sale_fee",
  264. label: "最终销售单价",
  265. width: "110px",
  266. },
  267. {
  268. prop: "color",
  269. label: "颜色",
  270. },
  271. {
  272. prop: "model",
  273. label: "型号",
  274. },
  275. {
  276. prop: "material",
  277. label: "材质",
  278. },
  279. // {
  280. // prop: "status",
  281. // label: "状态",
  282. // _slot_: "status",
  283. // width: "80px",
  284. // },
  285. {
  286. prop: "scheme_name",
  287. label: "方案名称",
  288. },
  289. {
  290. prop: "zxtime",
  291. label: "创建时间",
  292. width: "140px",
  293. },
  294. {
  295. prop: "",
  296. label: "操作",
  297. fixed: "right",
  298. _noset_: true,
  299. width: "80px",
  300. _slot_: "operation",
  301. },
  302. ],
  303. };
  304. },
  305. mounted() {
  306. this.searchList();
  307. },
  308. methods: {
  309. restSearch() {
  310. this.parmValue = {
  311. name: "", // 业务员名字
  312. username: "", // 账号
  313. status: "", //
  314. page: 1, // 页码
  315. size: 10, // 每页显示条数
  316. };
  317. this.searchList();
  318. },
  319. openModal(id, isDetail) {
  320. this.showModel = true;
  321. this.modelId = id;
  322. this.isDetail = isDetail;
  323. },
  324. async deleteById(id, status) {
  325. await this.$confirm("确定要删除?", {
  326. confirmButtonText: "确定",
  327. cancelButtonText: "取消",
  328. type: "warning",
  329. })
  330. .then(async () => {
  331. const model = {
  332. id: id,
  333. // status: status === "1" ? "0" : "1",
  334. };
  335. const res = await asyncRequest.delete(model);
  336. if (res && res.code === 0) {
  337. this.$notify.success({
  338. title: "删除成功",
  339. message: "",
  340. });
  341. this.searchList();
  342. } else if (res && res.code >= 100 && res.code <= 104) {
  343. await this.logout();
  344. } else {
  345. this.$message.warning(res.message);
  346. }
  347. })
  348. .catch(() => {
  349. console.log("取消");
  350. });
  351. },
  352. async searchList() {
  353. this.loading = true;
  354. const res = await asyncRequest.list(this.parmValue);
  355. if (res && res.code === 0 && res.data) {
  356. this.tableData = res.data.list;
  357. this.tableData.map((v) => {
  358. v.sale_price = this.setNum(v.sale_price);
  359. v.sale_fee = this.setNum(v.sale_fee);
  360. // v.num =
  361. //pa (v.sale_price);
  362. return v;
  363. });
  364. //
  365. this.pageInfo.total = Number(res.data.count);
  366. } else if (res && res.code >= 100 && res.code <= 104) {
  367. await this.logout();
  368. } else {
  369. this.tableData = [];
  370. this.pageInfo.total = 0;
  371. }
  372. this.loading = false;
  373. },
  374. },
  375. };
  376. </script>
  377. <style lang="scss" scoped>
  378. .consultOrder {
  379. }
  380. </style>