index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="app-container">
  3. <u-sticky bgColor="#fff">
  4. <view class="tab-container">
  5. <u-tabs :list="tabList" :scrollable="false" @click="changeTab"></u-tabs>
  6. </view>
  7. </u-sticky>
  8. <!-- 产品话术 -->
  9. <view class="list-container" v-if="curTab === 1">
  10. <view class="item" v-for="(item, index) in dataList" :key="index" @tap="openDetail(item.wordsTechniqueId)">
  11. <view class="title">{{item.wordsTechniqueName}}</view>
  12. <view class="row it2">
  13. <view class="label">品牌</view>
  14. <view class="value">{{item.brandName}}</view>
  15. </view>
  16. <view class="row it2">
  17. <view class="label">答案</view>
  18. <view class="value ellipsis-3">{{item.wordsTechniqueOverview}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <!-- 故障代码 -->
  23. <view class="list-container" v-if="curTab === 2">
  24. <view class="item" v-for="(item, index) in dataList" :key="index" @tap="openDetail(item.faultId)">
  25. <view class="row">
  26. <view class="label">产品品牌</view>
  27. <view class="value">{{item.brandName}}</view>
  28. </view>
  29. <view class="row">
  30. <view class="label">显示代码</view>
  31. <view class="value">{{item.faultCode}}</view>
  32. </view>
  33. <view class="row">
  34. <view class="label">适用产品</view>
  35. <view class="value">{{item.categoryName}}</view>
  36. </view>
  37. <view class="row">
  38. <view class="label">故障原因</view>
  39. <view class="value ellipsis-3">{{item.faultWhy}}</view>
  40. </view>
  41. <view class="row">
  42. <view class="label">备注内容</view>
  43. <view class="value ellipsis-3">{{item.remark}}</view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 说明书 -->
  48. <view class="list-container" v-if="curTab === 3">
  49. <view class="item" v-for="(item, index) in dataList" :key="index" @tap="openDetail(item.instructionsId)">
  50. <view class="title">{{item.instructionsName}}</view>
  51. <view class="row">
  52. <view class="label">产品品牌</view>
  53. <view class="value">{{item.brandName}}</view>
  54. </view>
  55. <view class="row">
  56. <view class="label">产品型号</view>
  57. <view class="value">{{item.productCode}}</view>
  58. </view>
  59. </view>
  60. </view>
  61. <u-empty
  62. mode="data"
  63. :icon="require('@/static/common/empty_data.png')"
  64. v-if="loadStatus == 'nomore' && dataList.length < 1">
  65. </u-empty>
  66. <u-loadmore :status="loadStatus" v-else />
  67. <u-action-sheet
  68. :title="curTab | titleFilter"
  69. :closeOnClickOverlay="true"
  70. :show="isShowDetail"
  71. :round="10"
  72. @close="isShowDetail = false">
  73. <!-- 产品话术 -->
  74. <view class="detail-container" v-if="curTab === 1">
  75. <view class="row">
  76. <view class="label">品牌</view>
  77. <view class="value">{{detail.brandName}}</view>
  78. </view>
  79. <view class="row">
  80. <view class="label">产品类别</view>
  81. <view class="value">{{detail.categoryName}}</view>
  82. </view>
  83. <view class="row">
  84. <view class="label">关键字词</view>
  85. <view class="value">{{detail.entryName}}</view>
  86. </view>
  87. <view class="row">
  88. <view class="label">问题</view>
  89. <view class="value ellipsis">{{detail.wordsTechniqueName}}</view>
  90. </view>
  91. <view class="row">
  92. <view class="label">答案</view>
  93. <view class="value">{{detail.wordsTechniqueOverview}}</view>
  94. </view>
  95. </view>
  96. <!-- 故障代码 -->
  97. <view class="detail-container" v-if="curTab === 2">
  98. <view class="title">{{detail.wordsTechniqueName}}</view>
  99. <view class="row">
  100. <view class="label">产品品牌</view>
  101. <view class="value">{{detail.brandName}}</view>
  102. </view>
  103. <view class="row">
  104. <view class="label">显示代码</view>
  105. <view class="value">{{detail.faultCode}}</view>
  106. </view>
  107. <view class="row">
  108. <view class="label">适用产品</view>
  109. <view class="value">{{detail.categoryName}}</view>
  110. </view>
  111. <view class="row">
  112. <view class="label">产品型号</view>
  113. <view class="value">{{detail.productCode}}</view>
  114. </view>
  115. <view class="row">
  116. <view class="label">故障原因</view>
  117. <view class="value ellipsis-3">{{detail.faultWhy}}</view>
  118. </view>
  119. <view class="row">
  120. <view class="label">备注内容</view>
  121. <view class="value ellipsis-3">{{detail.remark}}</view>
  122. </view>
  123. <view class="row">
  124. <view class="label">解除条件</view>
  125. <view class="value">{{detail.removeConditions}}</view>
  126. </view>
  127. </view>
  128. <!-- 说明书 -->
  129. <view class="detail-container" v-if="curTab === 3">
  130. <view class="row">
  131. <view class="label">标题</view>
  132. <view class="value">{{detail.instructionsName}}</view>
  133. </view>
  134. <view class="row">
  135. <view class="label">产品品牌</view>
  136. <view class="value">{{detail.brandName}}</view>
  137. </view>
  138. <view class="row">
  139. <view class="label">产品型号</view>
  140. <view class="value">{{detail.productCode}}</view>
  141. </view>
  142. </view>
  143. </u-action-sheet>
  144. </view>
  145. </template>
  146. <script>
  147. export default {
  148. filters: {
  149. titleFilter(val) {
  150. const MAP = {
  151. 1: '产品话术',
  152. 2: '故障代码',
  153. 3: '说明书',
  154. }
  155. return MAP[val]
  156. }
  157. },
  158. data() {
  159. return {
  160. tabList: [
  161. { name: '产品话术', value: 1 },
  162. { name: '故障代码', value: 2 },
  163. { name: '说明书', value: 3 },
  164. ],
  165. curTab: 1,
  166. dataList: [],
  167. pageNum: 1,
  168. loadStatus: 'loadmore', // 加载前=loadmore,加载中=loading,没有数据=nomore
  169. isShowDetail: false,
  170. detail: {},
  171. }
  172. },
  173. onLoad() {
  174. this.getList();
  175. },
  176. // 下拉刷新
  177. onPullDownRefresh() {
  178. this.pageNum = 1;
  179. this.getList();
  180. },
  181. // 上拉加载
  182. onReachBottom() {
  183. this.getList(1);
  184. },
  185. methods: {
  186. // 获取列表
  187. getList(loadMore) {
  188. if(this.loadStatus == 'nomore' && loadMore)return;
  189. this.loadStatus = 'loadmore';
  190. if(!loadMore){
  191. this.pageNum = 1;
  192. }else{
  193. this.loadStatus = 'loading';
  194. }
  195. let url = '';
  196. if(this.curTab === 1) {
  197. url = '/personal/words-technique'
  198. }else if(this.curTab === 2) {
  199. url = '/personal/fault'
  200. }else if(this.curTab === 3) {
  201. url = '/personal/instruction'
  202. }
  203. this.$api.post(url, {
  204. pageNum: this.pageNum,
  205. pageSize: 10,
  206. accountCode: this.$store.getters.usercode,
  207. }).then(res => {
  208. let _list = res.data.records;
  209. let pageTotal = res.data.pages;
  210. if(this.pageNum >= pageTotal){
  211. this.loadStatus = 'nomore';
  212. }
  213. if (_list.length) {
  214. this.pageNum += 1;
  215. }
  216. if (loadMore) {
  217. this.dataList = this.dataList.concat(_list);
  218. this.loadStatus = 'loadmore';
  219. } else {
  220. this.dataList = _list;
  221. }
  222. }).catch(res => {
  223. this.loadStatus = 'nomore';
  224. }).finally(res => {
  225. uni.stopPullDownRefresh();
  226. })
  227. },
  228. changeTab(item) {
  229. this.curTab = item.value;
  230. this.pageNum = 1;
  231. this.getList();
  232. },
  233. openDetail(id) {
  234. let url = '';
  235. let param = {};
  236. if(this.curTab === 1) {
  237. url = '/words-technique/detail';
  238. param = {wordsTechniqueId: id};
  239. }else if(this.curTab === 2) {
  240. url = '/fault/detail'
  241. param = {faultId: id};
  242. }else if(this.curTab === 3) {
  243. url = '/instructions/detail'
  244. param = {instructionsId: id};
  245. }
  246. this.$api.post(url, {
  247. source: 1,
  248. accountCode: this.$store.getters.usercode,
  249. ...param
  250. }).then(res => {
  251. this.detail = res.data;
  252. this.isShowDetail = true;
  253. })
  254. }
  255. }
  256. }
  257. </script>
  258. <style lang="scss" scoped>
  259. .app-container {
  260. padding-bottom: 1px;
  261. }
  262. .list-container {
  263. padding: 20rpx 30rpx 0;
  264. .item {
  265. padding: 20rpx 30rpx;
  266. background: #ffffff;
  267. border-radius: 20rpx;
  268. margin-bottom: 20rpx;
  269. .title {
  270. font-size: 30rpx;
  271. font-weight: 500;
  272. }
  273. .row {
  274. display: flex;
  275. margin-top: 14rpx;
  276. &:first-child {
  277. margin-top: 0;
  278. }
  279. .label {
  280. font-size: 28rpx;
  281. color: #666666;
  282. flex-shrink: 0;
  283. width: 140rpx;
  284. }
  285. .value {
  286. font-size: 28rpx;
  287. color: #333333;
  288. }
  289. &.it2 {
  290. .label {
  291. width: 80rpx !important;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. .detail-container {
  298. padding: 20rpx 30rpx 80rpx;
  299. text-align: left !important;
  300. .title {
  301. font-size: 30rpx;
  302. font-weight: 500;
  303. }
  304. .row {
  305. display: flex;
  306. margin-top: 14rpx;
  307. &:first-child {
  308. margin-top: 0;
  309. }
  310. .label {
  311. font-size: 28rpx;
  312. color: #666666;
  313. flex-shrink: 0;
  314. width: 140rpx;
  315. }
  316. .value {
  317. font-size: 28rpx;
  318. color: #333333;
  319. }
  320. &.it2 {
  321. .label {
  322. width: 80rpx !important;
  323. }
  324. }
  325. }
  326. }
  327. </style>