index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <div class="zxSheet 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: 140px">
  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: 420px; padding: 0 0 0 10px">
  53. <search-customer
  54. :value="customerCode"
  55. :size="searchSize"
  56. :placeholder="'客户公司名称'"
  57. @searchChange="customerChange"
  58. />
  59. </el-col>
  60. <el-col :span="3" style="width: 66px; float: right">
  61. <el-button
  62. :size="searchSize"
  63. type="primary"
  64. style="float: right; margin-left: 5px"
  65. @click="searchList"
  66. >
  67. 刷新
  68. </el-button>
  69. </el-col>
  70. </el-col>
  71. </el-row>
  72. <el-row style="padding: 10px 0 0 0">
  73. <el-col :span="24">
  74. <el-col :span="6" style="width: 292px">
  75. <period-date-picker
  76. :start="parmValue.start"
  77. :end="parmValue.end"
  78. :type="1"
  79. :width="'135px'"
  80. :size="searchSize"
  81. @timeReturned="timeReturned($event)"
  82. />
  83. </el-col>
  84. <el-col :span="4" style="width: 350px; padding: 0 0 0 10px">
  85. <el-input
  86. placeholder="关键字"
  87. v-model="input"
  88. :size="searchSize"
  89. >
  90. <el-select
  91. v-model="select"
  92. slot="prepend"
  93. placeholder="请选择"
  94. style="width: 115px"
  95. :size="searchSize"
  96. >
  97. <el-option label="咨询单编码" value="1"></el-option>
  98. <el-option label="申请人" value="2"></el-option>
  99. <el-option label="商品名称" value="3"></el-option>
  100. </el-select>
  101. <el-button
  102. slot="append"
  103. icon="el-icon-search"
  104. @click="
  105. pageInfo.curr = 1;
  106. parmValue.page = 1;
  107. searchList();
  108. "
  109. ></el-button>
  110. </el-input>
  111. </el-col>
  112. <el-col :span="4" style="width: 66px; float: right">
  113. <el-button
  114. type="warning"
  115. class="fr"
  116. :size="searchSize"
  117. @click="restSearch"
  118. >
  119. 重置
  120. </el-button>
  121. </el-col>
  122. </el-col>
  123. </el-row>
  124. </div>
  125. </template>
  126. <template #status="{ scope }">
  127. <el-tag
  128. :size="tablebtnSize"
  129. :type="scope.row.status == '0' ? 'warning' : ''"
  130. v-text="
  131. (statusOptions.find((item) => item.id == scope.row.status) || {})
  132. .label || '--'
  133. "
  134. ></el-tag>
  135. </template>
  136. <template #operation="{ scope }">
  137. <el-tooltip
  138. v-if="powers.some((item) => item == '007')"
  139. effect="dark"
  140. content="详情"
  141. placement="top"
  142. >
  143. <i
  144. class="el-icon-view tb-icon"
  145. @click="routeGoto('zxSheetDetail', { id: scope.row.id })"
  146. ></i>
  147. </el-tooltip>
  148. <!-- <el-tooltip
  149. v-if="powers.some((item) => item == '007')"
  150. effect="dark"
  151. content="创建咨询订单"
  152. placement="top"
  153. >
  154. <i
  155. class="el-icon-circle-plus-outline tb-icon"
  156. @click="addModal(scope.row.id, true)"
  157. ></i>
  158. </el-tooltip>
  159. <el-tooltip
  160. v-if="powers.some((item) => item == '006')"
  161. effect="dark"
  162. content="删除"
  163. placement="top"
  164. >
  165. <i
  166. class="el-icon-delete tb-icon"
  167. @click="deleteById(scope.row.id, scope.row.status)"
  168. ></i>
  169. </el-tooltip> -->
  170. </template>
  171. </ex-table>
  172. </div>
  173. <div v-else>
  174. <no-auth></no-auth>
  175. </div>
  176. </div>
  177. </template>
  178. <script>
  179. import mixinPage from "@/mixins/elPaginationHandle";
  180. import resToken from "@/mixins/resToken";
  181. import asyncRequest from "@/apis/service/sheetOrder/zxSheet";
  182. import { mapGetters } from "vuex";
  183. import columns from "./columns";
  184. export default {
  185. name: "zxSheet",
  186. mixins: [mixinPage, resToken],
  187. computed: {
  188. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  189. powers() {
  190. let tran =
  191. this.$store.getters.btnList.find(
  192. (item) => item.menu_route == "zxSheet"
  193. ) || {};
  194. if (tran && tran.action && tran.action.length > 0) {
  195. return tran.action;
  196. } else {
  197. return [];
  198. }
  199. },
  200. },
  201. data() {
  202. return {
  203. select: "1",
  204. input: "",
  205. addShowModel: false,
  206. addModelId: "",
  207. addIsDetail: false,
  208. customerCode: [],
  209. sitem: null,
  210. // 状态
  211. statusOptions: [
  212. { id: "0", label: "禁用" },
  213. { id: "1", label: "启用" },
  214. ],
  215. statusList: [
  216. "样品咨询单",
  217. "线上咨询",
  218. "线上贵金属",
  219. "线下咨询",
  220. "线下贵金属",
  221. "赠品咨询单",
  222. "项目竞聘",
  223. ],
  224. loading: true,
  225. showModel: false,
  226. isDetail: false,
  227. modelId: 0,
  228. parmValue: {
  229. zxNo: "", // 咨询单编码
  230. khNo: "", // 客户编码
  231. cpName: "", //商品名称
  232. zxtype: "", //咨询类型
  233. salesman: "", //申请人
  234. start: "",
  235. end: "",
  236. page: 1, // 页码
  237. size: 15, // 每页显示条数
  238. },
  239. tableData: [],
  240. passwordModel: false,
  241. passwordModelId: 0,
  242. isPasswordDetail: false,
  243. // 表格 - 数据
  244. tableData: [],
  245. // 表格 - 参数
  246. table: {
  247. stripe: true,
  248. border: true,
  249. _defaultHeader_: ["setcol"],
  250. },
  251. // 表格 - 分页
  252. pageInfo: {
  253. size: 15,
  254. curr: 1,
  255. total: 0,
  256. },
  257. // 表格 - 列参数
  258. columns: columns,
  259. };
  260. },
  261. mounted() {
  262. this.searchList();
  263. },
  264. methods: {
  265. async timeReturned(e) {
  266. if (e.startTime !== "") {
  267. this.parmValue.start = e.startTime;
  268. } else {
  269. this.parmValue.start = "";
  270. }
  271. if (e.endTime !== "") {
  272. this.parmValue.end = e.endTime;
  273. } else {
  274. this.parmValue.end = "";
  275. }
  276. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  277. this.parmValue.page = 1;
  278. await this.searchList();
  279. }
  280. },
  281. restSearch() {
  282. // 表格 - 分页
  283. this.pageInfo = {
  284. size: 15,
  285. curr: 1,
  286. total: 0,
  287. };
  288. this.select = "1";
  289. this.input = "";
  290. this.customerCode = [];
  291. this.parmValue = {
  292. zxNo: "", // 咨询单编码
  293. khNo: "", // 客户编码
  294. cpName: "", //商品名称
  295. zxtype: "", //咨询类型
  296. salesman: "", //申请人
  297. start: "",
  298. end: "",
  299. page: 1, // 页码
  300. size: 15, // 每页显示条数
  301. };
  302. this.searchList();
  303. },
  304. async customerChange(e) {
  305. if (e && e.id) {
  306. this.customerCode = [e.code];
  307. this.parmValue.khNo = e.code;
  308. } else {
  309. this.customerCode = [];
  310. this.parmValue.khNo = "";
  311. }
  312. this.parmValue.page = 1;
  313. await this.searchList();
  314. },
  315. openModal(id, isDetail) {
  316. this.showModel = true;
  317. this.modelId = id;
  318. this.isDetail = isDetail;
  319. },
  320. addModal(id, isDetail) {
  321. this.addShowModel = true;
  322. this.addModelId = id;
  323. this.addIsDetail = isDetail;
  324. },
  325. async deleteById(id, status) {
  326. await this.$confirm("确定要删除?", {
  327. confirmButtonText: "确定",
  328. cancelButtonText: "取消",
  329. type: "warning",
  330. })
  331. .then(async () => {
  332. const model = {
  333. id: id,
  334. // status: status === "1" ? "0" : "1",
  335. };
  336. const res = await asyncRequest.delete(model);
  337. if (res && res.code === 0) {
  338. this.$notify.success({
  339. title: "删除成功",
  340. message: "",
  341. });
  342. this.searchList();
  343. } else if (res && res.code >= 100 && res.code <= 104) {
  344. await this.logout();
  345. } else {
  346. this.$message.warning(res.message);
  347. }
  348. })
  349. .catch(() => {
  350. console.log("取消");
  351. });
  352. },
  353. async searchList() {
  354. this.loading = true;
  355. this.parmValue.zxNo = this.select === "1" ? this.input : ""; //咨询类型
  356. this.parmValue.salesman = this.select === "2" ? this.input : ""; //申请人
  357. this.parmValue.cpName = this.select === "3" ? this.input : ""; //商品名称
  358. const res = await asyncRequest.list(this.parmValue);
  359. if (res && res.code === 0 && res.data) {
  360. this.tableData = res.data.list;
  361. this.tableData.map((v) => {
  362. v.sale_price = this.setNum(v.sale_price);
  363. v.sale_fee = this.setNum(v.sale_fee);
  364. v.class_cat = "";
  365. if (v.can && v.can.length > 0) {
  366. v.can.forEach((x, i) => {
  367. v.class_cat += i === 0 ? x.name : "/" + x.name;
  368. });
  369. }
  370. return v;
  371. });
  372. this.pageInfo.total = Number(res.data.count);
  373. } else if (res && res.code >= 100 && res.code <= 104) {
  374. await this.logout();
  375. } else {
  376. this.tableData = [];
  377. this.pageInfo.total = 0;
  378. }
  379. this.loading = false;
  380. },
  381. },
  382. };
  383. </script>
  384. <style lang="scss" scoped>
  385. .zxSheet {
  386. }
  387. </style>