index.vue 8.8 KB

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