index.vue 11 KB

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