index.vue 8.4 KB

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