index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div class="better-scroll wrapper" ref="wrapper">
  3. <ul>
  4. <li class="list" v-for="(item, index) in listData" :key="index">
  5. <div class="name-wrap">
  6. <div class="avatar">
  7. <img :src="item.userHeadImgUrl" alt="">
  8. </div>
  9. <p class="name">{{ item.orderUserName }}</p>
  10. </div>
  11. <p class="phone">手机号:{{ item.orderUserPhone }}</p>
  12. <div class="loan-info">
  13. <p class="label">申请产品:{{ item.orderProduceName }}</p>
  14. <p>
  15. <span class="label">需求金额:</span>
  16. <span class="value">{{ item.orderPrice / 10000 }}万元</span>
  17. </p>
  18. </div>
  19. <p class="create-time">申请时间:{{ item.createdAt }}</p>
  20. <!--orderFinalStatus:0-进行中 1-成功 2-失败-->
  21. <p class="status bg-0" v-if="item.orderFinalStatus === 0">进度:{{ item.orderStatus }}</p>
  22. <p class="status bg-1" v-if="item.orderFinalStatus === 1">{{ item.orderStatus }}</p>
  23. <p class="status bg-2" v-if="item.orderFinalStatus === 2">{{ item.orderStatus }}</p>
  24. </li>
  25. <li class="load-status" v-if="listData.length && booFetchData">
  26. <p>{{ arrFetchStatus[numFetchStatus] }}</p>
  27. </li>
  28. <li class="bitmap" v-if="!listData.length && booFetchData">
  29. <p>暂无记录</p>
  30. </li>
  31. </ul>
  32. </div>
  33. </template>
  34. <script>
  35. import BScroll from 'better-scroll'
  36. import { Toast } from 'vant'
  37. import { mapGetters } from 'vuex'
  38. import { saleList } from './api'
  39. const PAGESIZE = 20
  40. export default {
  41. name: 'marketing',
  42. data () {
  43. return {
  44. pager: {
  45. pagenum: 1,
  46. pagesize: PAGESIZE,
  47. pagecount: 1
  48. },
  49. listData: [],
  50. scroll: null,
  51. numFetchStatus: 0,
  52. arrFetchStatus: ['正在加载,请稍后~', '上拉加载更多', '没有更多了', '出错啦'],
  53. booFetchData: false
  54. }
  55. },
  56. activated () {
  57. if (!this.$route.meta.isUseCache) {
  58. this.pager = {
  59. pagenum: 1,
  60. pagesize: PAGESIZE,
  61. pagecount: 1
  62. }
  63. this.listData = []
  64. this.numFetchStatus = 0
  65. this.booFetchData = false
  66. this.funFetch()
  67. } else {
  68. this.$nextTick(() => {
  69. if (this.scroll) {
  70. this.scroll.refresh()
  71. }
  72. })
  73. }
  74. this.$nextTick(() => {
  75. this.$refreshTitle('妥妥推手')
  76. })
  77. },
  78. computed: {
  79. ...mapGetters({
  80. search: 'business/searchValueOfMyCustomer',
  81. isSearchOfMyCustomer: 'business/isSearchOfMyCustomer'
  82. })
  83. },
  84. watch: {
  85. isSearchOfMyCustomer: {
  86. handler: function (newVal) {
  87. if (!newVal) {
  88. return
  89. }
  90. this.pager = {
  91. pagenum: 1,
  92. pagesize: PAGESIZE,
  93. pagecount: 1
  94. }
  95. this.listData = []
  96. this.numFetchStatus = 0
  97. this.booFetchData = false
  98. this.funFetch()
  99. }
  100. }
  101. },
  102. methods: {
  103. funFetch () {
  104. const vm = this
  105. vm.numFetchStatus = 0
  106. // 搜索按钮置为默认状态
  107. if (this.isSearchOfMyCustomer) {
  108. vm.$store.dispatch('business/setIsSearchOfMyCustomer', 0)
  109. }
  110. saleList(vm.pager.pagenum, vm.pager.pagesize, this.search).then(response => {
  111. if (response.status) {
  112. const data = response.data
  113. const temp = data.data
  114. vm.pager.pagecount = Math.ceil(data.count / PAGESIZE)
  115. vm.pager.pagenum++
  116. vm.booFetchData = true
  117. if (vm.pager.pagecount <= 1) {
  118. vm.numFetchStatus = 2
  119. } else {
  120. vm.numFetchStatus = 1
  121. }
  122. if (temp.length) {
  123. vm.listData = vm.listData.concat(temp)
  124. vm.$nextTick(() => {
  125. if (!vm.scroll) {
  126. vm.scroll = new BScroll(vm.$refs.wrapper, {
  127. click: true,
  128. pullUpLoad: {
  129. threshold: -20
  130. },
  131. scrollbar: true
  132. })
  133. vm.scroll.on('pullingUp', () => {
  134. if (vm.pager.pagenum > vm.pager.pagecount) {
  135. vm.numFetchStatus = 2
  136. return
  137. }
  138. vm.funFetch()
  139. })
  140. } else {
  141. vm.scroll.refresh()
  142. vm.scroll.finishPullUp()
  143. }
  144. })
  145. }
  146. } else {
  147. Toast(response.msg)
  148. vm.numFetchStatus = 3
  149. }
  150. }).catch(() => {
  151. Toast('出错啦')
  152. vm.numFetchStatus = 3
  153. })
  154. }
  155. },
  156. beforeRouteLeave (to, from, next) {
  157. if (['partnerAll', 'partnerGoods', 'partnerMine'].includes(to.name)) {
  158. from.meta.isUseCache = true
  159. }
  160. this.$store.dispatch('business/setDefaultNav', from.path)
  161. next()
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .wrapper {
  167. position: relative;
  168. width: 100%;
  169. height: calc(100vh - 242px);
  170. overflow: hidden;
  171. ul {
  172. width: 100%;
  173. padding-bottom: 200px;
  174. }
  175. }
  176. .list {
  177. position: relative;
  178. left: 0;
  179. top: 0;
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. width: 100%;
  184. padding: 19px 0 16px;
  185. margin-top: 12px;
  186. border-radius: 4px;
  187. background: #FFF;
  188. box-shadow: 0 2px 0px -1px rgba(224, 224, 224, 0.5);
  189. &:nth-of-type(1) {
  190. margin-top: 0;
  191. }
  192. }
  193. .name-wrap {
  194. display: flex;
  195. align-items: center;
  196. width: 331px;
  197. }
  198. .avatar {
  199. width: 25px;
  200. height: 25px;
  201. margin-right: 13px;
  202. border-radius: 50%;
  203. overflow: hidden;
  204. img {
  205. display: block;
  206. width: 100%;
  207. }
  208. }
  209. .name,
  210. .phone {
  211. line-height: 20px;
  212. font-size: 15px;
  213. font-weight: 500;
  214. color: #333;
  215. }
  216. .phone {
  217. width: 331px;
  218. margin-top: 14px;
  219. }
  220. .loan-info {
  221. display: flex;
  222. align-items: center;
  223. width: 331px;
  224. margin-top: 7px;
  225. p {
  226. display: flex;
  227. align-items: center;
  228. &:nth-of-type(2) {
  229. margin-left: 17px;
  230. }
  231. }
  232. .label {
  233. line-height: 20px;
  234. font-size: 15px;
  235. color: #333;
  236. }
  237. .value {
  238. line-height: 20px;
  239. font-size: 15px;
  240. font-weight: 500;
  241. color: #EE0A23;
  242. }
  243. }
  244. .create-time {
  245. width: 331px;
  246. margin-top: 7px;
  247. line-height: 17px;
  248. font-size: 12px;
  249. color: #999;
  250. }
  251. .status {
  252. position: absolute;
  253. right: 16px;
  254. top: 16px;
  255. z-index: 1;
  256. padding: 0 8px;
  257. border-radius: 4px;
  258. line-height: 22px;
  259. font-size: 15px;
  260. font-weight: 500;
  261. color: #fff;
  262. &.bg-0 {
  263. background: #F39D41;
  264. }
  265. &.bg-1 {
  266. background: #53DA6A;
  267. }
  268. &.bg-2 {
  269. background: #EE0A23;
  270. }
  271. }
  272. .load-status {
  273. margin-top: 12px;
  274. p {
  275. line-height: 20px;
  276. font-size: 14px;
  277. color: #666;
  278. text-align: center;
  279. }
  280. }
  281. .bitmap {
  282. p {
  283. line-height: 22px;
  284. font-size: 16px;
  285. font-weight: 500;
  286. text-align: center;
  287. color: #333;
  288. }
  289. }
  290. </style>