index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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" 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. <u-toast ref="uToast"></u-toast>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. deleteInformation
  64. } from '@/api/saleManage/businessOpportunity/index.js'
  65. import {
  66. getTableList,
  67. revokeSalesDemand
  68. } from '@/api/salesServiceManagement/demandList/index.js'
  69. import myCard from '@/pages/saleManage/components/myCard.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. doSearch() {
  210. this.isEnd = false
  211. this.page = 1
  212. this.getList()
  213. },
  214. //获取列表信息
  215. getList() {
  216. if (this.isEnd) {
  217. return
  218. }
  219. uni.showLoading({
  220. title: '加载中'
  221. })
  222. let data = {
  223. pageNum: this.page,
  224. size: this.size,
  225. type: 1,
  226. }
  227. getTableList(data).then(res => {
  228. if (this.page === 1) {
  229. this.tableList = res.list
  230. } else {
  231. this.tableList.push(...res.list)
  232. }
  233. this.page += 1
  234. this.isEnd = this.tableList.length >= res.count
  235. uni.hideLoading();
  236. }).catch((e) => {
  237. uni.hideLoading()
  238. })
  239. },
  240. hidePopup() {
  241. this.$refs.popup.close();
  242. this.examForm = {
  243. auditOpinion: '',
  244. auditResult: '',
  245. id: ''
  246. };
  247. },
  248. // 撤回
  249. async handleRevoke(row) {
  250. const res = await uni.showModal({
  251. title: '确认撤回',
  252. content: '确定要撤回该条数据吗?',
  253. confirmText: '撤回',
  254. confirmColor: '#FF4D4F',
  255. });
  256. if (res[1].confirm) {
  257. const data = await revokeSalesDemand({
  258. id: row.id
  259. });
  260. if (!data) return
  261. this.$refs.uToast.show({
  262. type: "success",
  263. message: "操作成功",
  264. })
  265. this.doSearch();
  266. } else if (res.cancel) {
  267. console.log('用户取消');
  268. }
  269. },
  270. add(type, id) {
  271. uni.navigateTo({
  272. url: `/pages/salesServiceManagement/demandList/add?type=${type}&id=${id}`
  273. })
  274. },
  275. scrolltolower() {
  276. if (this.isEnd) {
  277. return
  278. }
  279. this.getList();
  280. },
  281. async del(item) {
  282. console.log(item, 'item ---')
  283. const res = await uni.showModal({
  284. title: '确认删除',
  285. content: '确定要删除该条数据吗?',
  286. confirmText: '删除',
  287. confirmColor: '#FF4D4F',
  288. });
  289. if (res[1].confirm) {
  290. const data = await deleteInformation([row.id])
  291. if (!data) return
  292. this.$refs.uToast.show({
  293. type: "success",
  294. message: "操作成功",
  295. })
  296. this.doSearch();
  297. } else if (res.cancel) {
  298. console.log('用户取消');
  299. }
  300. // deleteInformation([item.id]).then(res => {
  301. // this.isEnd = false
  302. // this.page = 1
  303. // this.$refs.uToast.show({
  304. // type: "success",
  305. // message: "操作成功",
  306. // })
  307. // this.getList(this.where)
  308. // })
  309. },
  310. handleAudit(item) {
  311. console.log(item,'iitem --')
  312. uni.navigateTo({
  313. url: `/pages/salesServiceManagement/demandList/components/submission?id=${item.id}`
  314. })
  315. },
  316. }
  317. }
  318. </script>
  319. <style lang="scss" scoped>
  320. .add {
  321. width: 96rpx;
  322. height: 96rpx;
  323. border-radius: 48rpx;
  324. background: #3c9cff;
  325. position: fixed;
  326. bottom: 100rpx;
  327. right: 24rpx;
  328. display: flex;
  329. align-items: center;
  330. justify-content: center;
  331. }
  332. .top-wrapper {
  333. background-color: #fff;
  334. display: flex;
  335. width: 750rpx;
  336. height: 88rpx;
  337. padding: 16rpx 32rpx;
  338. align-items: center;
  339. gap: 16rpx;
  340. /deep/.uni-section {
  341. margin-top: 0px;
  342. }
  343. /deep/.uni-section-header {
  344. padding: 0px;
  345. }
  346. .search_btn {
  347. width: 120rpx;
  348. height: 70rpx;
  349. line-height: 70rpx;
  350. padding: 0 24rpx;
  351. background: $theme-color;
  352. font-size: 32rpx;
  353. color: #fff;
  354. margin: 0;
  355. margin-left: 26rpx;
  356. }
  357. .menu_icon {
  358. width: 44rpx;
  359. height: 44rpx;
  360. margin-left: 14rpx;
  361. }
  362. }
  363. </style>