index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back" title="售后需求"
  4. @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <uni-section>
  8. <uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchVal"
  9. placeholder="关键字">
  10. </uni-easyinput>
  11. </uni-section>
  12. <button class="search_btn" @click="doSearch">搜索</button>
  13. <image class="menu_icon" @click="showSearch" src="~@/static/pda/menu.svg"></image>
  14. </view>
  15. <view class="wrapper">
  16. <u-list @scrolltolower="scrolltolower" class="listContent">
  17. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  18. <myCard @del="del(item)" @handleAudit="handleAudit(item)" @handleRevoke="handleRevoke(item)"
  19. @edit="add('edit',item.id)" @details="add('view',item.id)" :item="item" :index="index+1"
  20. :columns="columns" :btnList="btnList">
  21. </myCard>
  22. </view>
  23. </u-list>
  24. </view>
  25. <view style='margin-top: 20vh;' v-if="tableList.length==0">
  26. <u-empty iconSize='150' textSize='32' text='暂无数据'>
  27. </u-empty>
  28. </view>
  29. <view class="add" @click="add('add','')">
  30. <u-icon name="plus" color="#fff"></u-icon>
  31. </view>
  32. <uni-popup ref="popup" type="center" :mask-closable="false">
  33. <view class="popup-content">
  34. <view class="popup-header">
  35. <text>审核</text>
  36. <view class="close-icon" @click="hidePopup">×</view>
  37. </view>
  38. <form @submit="handleSubmit">
  39. <view class="form-item">
  40. <label class="form-label">*审核结果</label>
  41. <!-- <uni-data-picker v-model="examForm.auditResult" slot="value" placeholder="请选择"
  42. :localdata="auditResultOptions" @change="handleAuditResultChange">
  43. </uni-data-picker> -->
  44. <!-- <uni-data-picker name="auditResult" :localdata="auditResultOptions"
  45. v-model="examForm.auditResult" @change="handleAuditResultChange">
  46. </uni-data-picker> -->
  47. </view>
  48. <view class="form-item">
  49. <label class="form-label">审核意见</label>
  50. <textarea name="auditOpinion" placeholder="请输入" v-model="examForm.auditOpinion"></textarea>
  51. </view>
  52. <view class="button-group">
  53. <button formType="submit" type="primary">确认</button>
  54. <button @click="hidePopup">取消</button>
  55. </view>
  56. </form>
  57. </view>
  58. </uni-popup>
  59. <u-toast ref="uToast"></u-toast>
  60. <MySearch :show.sync="searchShow" :formItems="formItems" @search="confirmSearch" ref="mySearchRef">
  61. </MySearch>
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. getByCode
  67. } from '@/api/pda/common.js'
  68. import {
  69. initDict
  70. } from '@/utils/utils.js'
  71. import {
  72. getTableList,
  73. revokeSalesDemand,
  74. deleteSalesDemand
  75. } from '@/api/salesServiceManagement/demandList/index.js'
  76. import myCard from '@/pages/saleManage/components/myCard.vue'
  77. export default {
  78. components: {
  79. myCard,
  80. },
  81. watch: {
  82. fault_level_arr: {
  83. handler(val) {
  84. console.log(val);
  85. this.formItems.find(item => item.prop === 'faultLevel').props.localdata = val
  86. },
  87. deep: true
  88. }
  89. },
  90. data() {
  91. return {
  92. searchForm: {},
  93. emptyShow: false,
  94. searchShow: false,
  95. fault_level_obj: {},
  96. fault_level_arr: [],
  97. formItems: [{
  98. label: '客户名称:',
  99. prop: 'contactName',
  100. component: 'MyInput',
  101. props: {
  102. placeholder: '请输入内容',
  103. }
  104. },
  105. {
  106. label: '编码:',
  107. prop: 'code',
  108. component: 'MyInput',
  109. props: {
  110. placeholder: '请输入内容',
  111. }
  112. },
  113. {
  114. label: '客户编码:',
  115. prop: 'contactCode',
  116. component: 'MyInput',
  117. props: {
  118. placeholder: '请输入内容',
  119. }
  120. },
  121. {
  122. label: '创建人:',
  123. prop: 'createUserName',
  124. component: 'MyInput',
  125. props: {
  126. placeholder: '请输入内容',
  127. }
  128. },
  129. {
  130. label: '故障等级:',
  131. prop: 'faultLevel',
  132. component: 'MySelect',
  133. props: {
  134. localdata: [],
  135. dataKey: 'label',
  136. dataValue: 'value'
  137. }
  138. },
  139. {
  140. label: '状态:',
  141. prop: 'demandStatus',
  142. component: 'MySelect',
  143. props: {
  144. localdata: [{
  145. label: '待提交',
  146. value: 0
  147. }, {
  148. label: '已提交',
  149. value: 1
  150. }, {
  151. label: '已关闭',
  152. value: 3
  153. }, {
  154. label: '已撤回',
  155. value: 4
  156. }],
  157. dataKey: 'label',
  158. dataValue: 'value',
  159. }
  160. },
  161. ],
  162. tableList: [],
  163. searchVal: '',
  164. page: 1,
  165. size: 10,
  166. isEnd: false,
  167. current: {},
  168. examForm: {
  169. auditOpinion: '',
  170. auditResult: '',
  171. id: ''
  172. },
  173. btnList: [{
  174. name: '详情',
  175. apiName: 'details',
  176. btnType: 'primary',
  177. type: '2',
  178. pageUrl: '',
  179. }, {
  180. name: '修改',
  181. apiName: 'edit',
  182. btnType: 'primary',
  183. type: '2',
  184. pageUrl: '',
  185. judge: [{
  186. authorities: '',
  187. }, {
  188. key: 'demandStatus',
  189. value: [0, 2, 3, 4, 5],
  190. }],
  191. },
  192. {
  193. name: '删除',
  194. apiName: 'del',
  195. btnType: 'error ',
  196. type: '2',
  197. pageUrl: '',
  198. judge: [{
  199. authorities: '',
  200. }, {
  201. key: 'demandStatus',
  202. value: [0, 2, 3, 4, 5],
  203. }],
  204. }, {
  205. name: '提交',
  206. apiName: 'handleAudit',
  207. btnType: 'primary',
  208. type: '2',
  209. pageUrl: '',
  210. judge: [{
  211. authorities: '',
  212. }, {
  213. key: 'demandStatus',
  214. value: [0],
  215. }],
  216. },
  217. {
  218. name: '撤回',
  219. apiName: 'handleRevoke',
  220. btnType: 'primary',
  221. type: '2',
  222. pageUrl: '',
  223. judge: [{
  224. authorities: '',
  225. }, {
  226. key: 'demandStatus',
  227. value: [0],
  228. }],
  229. }
  230. ],
  231. columns: [
  232. [{
  233. label: '名称:',
  234. prop: 'name',
  235. type: 'title',
  236. className: 'perce100',
  237. }],
  238. [{
  239. label: '编码:',
  240. prop: 'code'
  241. }, {
  242. label: '客户编码:',
  243. prop: 'contactCode'
  244. }],
  245. [{
  246. label: '客户名称:',
  247. prop: 'contactName'
  248. }, {
  249. label: '故障等级:',
  250. prop: 'faultLevel',
  251. formatter: (row) => {
  252. return this.fault_level_obj && this.fault_level_obj[row.faultLevel] || ''
  253. }
  254. }],
  255. [{
  256. label: '创建人:',
  257. prop: 'createUserName'
  258. }, {
  259. label: '创建时间:',
  260. prop: 'createTime',
  261. }],
  262. // [{
  263. // label: '审核人:',
  264. // prop: 'approvalUserName'
  265. // }, {
  266. // label: '状态:',
  267. // prop: 'demandStatus',
  268. // formatter: (row) => {
  269. // let cellValue = row.demandStatus;
  270. // return cellValue == 0 ?
  271. // '待审核' :
  272. // cellValue == 2 ?
  273. // '已拒绝' :
  274. // cellValue == 1 ?
  275. // '已通过' :
  276. // cellValue == 3 ?
  277. // '已撤回' :
  278. // '';
  279. // }
  280. // }],
  281. [{
  282. label: '操作:',
  283. prop: 'action',
  284. type: 'action',
  285. className: 'perce100',
  286. }],
  287. ]
  288. }
  289. },
  290. onReachBottom() {
  291. console.log('123');
  292. this.getList()
  293. },
  294. onLoad() {
  295. this.getDict()
  296. },
  297. onShow() {
  298. this.doSearch();
  299. },
  300. methods: {
  301. async getDict() {
  302. let res = await getByCode('fault_level')
  303. let [arr, obj] = initDict(res)
  304. this.fault_level_obj = obj
  305. this.fault_level_arr = arr
  306. console.log(this.fault_level_obj);
  307. // console.log(arr, obj);
  308. },
  309. doSearch() {
  310. this.isEnd = false
  311. this.page = 1
  312. this.getList()
  313. },
  314. //获取列表信息
  315. getList() {
  316. if (this.isEnd) {
  317. this.$refs.uToast.show({
  318. message: "暂无更多数据",
  319. duration: 1000
  320. })
  321. return
  322. }
  323. uni.showLoading({
  324. title: '加载中'
  325. })
  326. let data = {
  327. pageNum: this.page,
  328. size: this.size,
  329. keyWord: this.searchVal,
  330. ...this.searchForm
  331. }
  332. getTableList(data).then(res => {
  333. if (this.page === 1) {
  334. this.tableList = res.list
  335. if (this.tableList.length === 0) {
  336. this.emptyShow = true
  337. }
  338. } else {
  339. this.tableList.push(...res.list)
  340. }
  341. this.page += 1
  342. this.isEnd = this.tableList.length >= res.count
  343. uni.hideLoading();
  344. }).catch((e) => {
  345. uni.hideLoading()
  346. })
  347. },
  348. hidePopup() {
  349. this.$refs.popup.close();
  350. this.examForm = {
  351. auditOpinion: '',
  352. auditResult: '',
  353. id: ''
  354. };
  355. },
  356. // 撤回
  357. async handleRevoke(row) {
  358. const res = await uni.showModal({
  359. title: '确认撤回',
  360. content: '确定要撤回该条数据吗?',
  361. confirmText: '撤回',
  362. confirmColor: '#FF4D4F',
  363. });
  364. if (res[1].confirm) {
  365. const data = await revokeSalesDemand({
  366. id: row.id
  367. });
  368. if (!data) return
  369. this.$refs.uToast.show({
  370. type: "success",
  371. message: "操作成功",
  372. })
  373. this.doSearch();
  374. } else if (res.cancel) {
  375. console.log('用户取消');
  376. }
  377. },
  378. add(type, id) {
  379. uni.navigateTo({
  380. url: `/pages/salesServiceManagement/demandList/add?type=${type}&id=${id}`
  381. })
  382. },
  383. scrolltolower() {
  384. if (this.isEnd) {
  385. return
  386. }
  387. this.getList();
  388. },
  389. async del(row) {
  390. const res = await uni.showModal({
  391. title: '确认删除',
  392. content: '确定要删除该条数据吗?',
  393. confirmText: '删除',
  394. confirmColor: '#FF4D4F',
  395. });
  396. if (res[1].confirm) {
  397. const data = await deleteSalesDemand([row.id])
  398. if (!data) return
  399. this.$refs.uToast.show({
  400. type: "success",
  401. message: "操作成功",
  402. })
  403. this.doSearch();
  404. } else if (res.cancel) {
  405. console.log('用户取消');
  406. }
  407. // deleteInformation([item.id]).then(res => {
  408. // this.isEnd = false
  409. // this.page = 1
  410. // this.$refs.uToast.show({
  411. // type: "success",
  412. // message: "操作成功",
  413. // })
  414. // this.getList(this.where)
  415. // })
  416. },
  417. handleAudit(item) {
  418. console.log(item, 'iitem --')
  419. uni.navigateTo({
  420. url: `/pages/salesServiceManagement/demandList/components/submission?id=${item.id}`
  421. })
  422. },
  423. clearSearch() {
  424. this.searchVal = ''
  425. this.doSearch()
  426. },
  427. showSearch() {
  428. this.searchShow = true
  429. },
  430. confirmSearch(e) {
  431. console.log(e);
  432. let data = JSON.parse(JSON.stringify(e))
  433. this.searchForm = data
  434. this.doSearch()
  435. },
  436. }
  437. }
  438. </script>
  439. <style lang="scss" scoped>
  440. .add {
  441. width: 96rpx;
  442. height: 96rpx;
  443. border-radius: 48rpx;
  444. background: #3c9cff;
  445. position: fixed;
  446. bottom: 100rpx;
  447. right: 24rpx;
  448. display: flex;
  449. align-items: center;
  450. justify-content: center;
  451. }
  452. .wrapper {}
  453. .top-wrapper {
  454. background-color: #fff;
  455. display: flex;
  456. width: 750rpx;
  457. height: 88rpx;
  458. padding: 16rpx 32rpx;
  459. align-items: center;
  460. gap: 16rpx;
  461. /deep/.uni-section {
  462. margin-top: 0px;
  463. }
  464. /deep/.uni-section-header {
  465. padding: 0px;
  466. }
  467. .search_btn {
  468. width: 120rpx;
  469. height: 70rpx;
  470. line-height: 70rpx;
  471. padding: 0 24rpx;
  472. background: $theme-color;
  473. font-size: 32rpx;
  474. color: #fff;
  475. margin: 0;
  476. margin-left: 26rpx;
  477. }
  478. .menu_icon {
  479. width: 44rpx;
  480. height: 44rpx;
  481. margin-left: 14rpx;
  482. }
  483. }
  484. </style>