index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view style="background-color: #f2f2f6;padding-bottom: 0.01rpx;" :class="mask ? 'tl-show': ''">
  3. <view style="background-color: #fff;position: fixed;top: var(--window-top);width: 100%;z-index: 8;">
  4. <view style="background-color: #fff;padding: 10rpx 20rpx;">
  5. <u-search placeholder="请输入客户名称" v-model="form.cname" @custom="custom" @search="custom"></u-search>
  6. <!--<view style="display: flex;align-items: center;margin-top: 4rpx;">
  7. <view style="font-size: 14px;color: #303133;margin-right: 4px;">
  8. 未购买天数
  9. </view>
  10. <u-search placeholder="请输入天数" v-model="form.days" :showAction='false'></u-search>
  11. <view>
  12. <view style="padding:0 4px;" @tap="popupShow=true">
  13. <u-icon name="list" size="21" bold></u-icon>
  14. </view>
  15. </view>
  16. </view> -->
  17. </view>
  18. <sh-filter ref="shFilter" :list="list" @setData="shfilterChange" :defaultValue="defaultValue"></sh-filter>
  19. <!-- <u-tabs :list="tabsList" keyName="dictValue" itemStyle="height:88rpx;" lineColor="#FD4B09"
  20. @click="tabsClick" :current="current">
  21. <view slot="right" style="padding:0 4px;" @tap="popupShow=true">
  22. <u-icon name="list" size="21" bold></u-icon>
  23. </view>
  24. </u-tabs> -->
  25. <!-- <view class="tabFilter">
  26. <u-tag v-if='form.days' :text="form.days+'天'" plain size="mini" style="margin-left: 10px;"></u-tag>
  27. <u-tag v-if='form.notPurchased==1' text="未购买" plain size="mini" style="margin-left: 10px;"></u-tag>
  28. <u-tag v-if='form.sort==1' text="业务员" plain size="mini" style="margin-left: 10px;"></u-tag>
  29. <u-tag v-if='form.sort==2' text="客户" plain size="mini" style="margin-left: 10px;"></u-tag>
  30. <u-tag v-if='form.sort==3' text="地址" plain size="mini" style="margin-left: 10px;"></u-tag>
  31. <u-tag v-if='form.sort==4' text="日期" plain size="mini" style="margin-left: 10px;"></u-tag>
  32. </view> -->
  33. </view>
  34. <view class="content" style="margin-top:90px">
  35. <view class="contentBox" v-for="(item,index) in dataList" :key="index">
  36. <view style="width: 100%;margin: 0 auto;" @click="inPage(item)">
  37. <u-cell-group :border="false">
  38. <u-cell :border="false" center :title="item.cname" arrow-direction="down">
  39. <view slot="icon" style="width: 10rpx;height: 35rpx;background-color: #fd4b09;"></view>
  40. </u-cell>
  41. </u-cell-group>
  42. <!-- blade-system/dict-biz/dictionary?code=outbound_work_order_status -->
  43. <view class="textBox">
  44. <view>最后一次购买日期</view>
  45. <view>{{item.businesDate?item.businesDate:'-'}}</view>
  46. </view>
  47. <view class="textBox">
  48. <view>未购买天数</view>
  49. <view>{{item.days?item.days:'-'}}</view>
  50. </view>
  51. <view class="textBox">
  52. <view>业务员</view>
  53. <view style="max-width: 500rpx;">{{item.salesmanName?item.salesmanName:'-'}}</view>
  54. </view>
  55. <view class="textBox">
  56. <view>电话</view>
  57. <view>{{item.tel?item.tel:'-'}}</view>
  58. </view>
  59. <view class="textBox">
  60. <view>默认地址</view>
  61. <view style="max-width: 500rpx;">{{item.detailedAddress?item.detailedAddress:'-'}}</view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <u-popup :show="popupShow" :round="10" @close="popupClose" closeable>
  67. <view style="padding: 10px;">
  68. <view style="display: flex;justify-content: center;font-size: 36rpx;">
  69. <text>排序</text>
  70. </view>
  71. <u--form style="margin-bottom: 20px;" labelPosition="left" :model="form" ref="uForm">
  72. <!-- <u-form-item label="查询天数" borderBottom :labelWidth='66'>
  73. <u-input v-model="form.days" placeholder="请输入查询天数" border="none" type="number"></u-input>
  74. </u-form-item> -->
  75. <u-form-item label="排序" borderBottom :labelWidth='66'>
  76. <u-radio-group v-model='form.sort'>
  77. <u-radio :name="1">业务员</u-radio>
  78. <u-radio :name="2">客户</u-radio>
  79. <u-radio :name="3">地址</u-radio>
  80. </u-radio-group>
  81. </u-form-item>
  82. <u-form-item label="未购买" borderBottom :labelWidth='66'>
  83. <u-switch v-model="form.notPurchased" :activeValue='1' :inactiveValue='null'></u-switch>
  84. </u-form-item>
  85. </u--form>
  86. <view style="display: flex;">
  87. <u-button style="margin-right: 4px;" text="重置" @click='reset'></u-button>
  88. <u-button type="primary" text="检索" @click='submit'></u-button>
  89. </view>
  90. </view>
  91. </u-popup>
  92. <u-back-top :scroll-top="scrollTop" icon="arrow-up" :customStyle="{backgroundColor:'#FD4B09'}"
  93. :iconStyle="{color:'#fff'}"></u-back-top>
  94. </view>
  95. </template>
  96. <script>
  97. import {
  98. getList
  99. } from '@/api/views/customerAnalysis/index.js'
  100. export default {
  101. data() {
  102. return {
  103. defaultValue: {
  104. "days": ["30"],
  105. "notPurchased": [],
  106. "sort": ["1"]
  107. },
  108. list: [{
  109. label: '未购买天数',
  110. type: 'select',
  111. mode: 'cell',
  112. min: 1,
  113. max: 1,
  114. field: 'days',
  115. child: [{
  116. label: '30天',
  117. value: '30',
  118. },
  119. {
  120. label: '60天',
  121. value: '60',
  122. },
  123. {
  124. label: '120天',
  125. value: '120',
  126. },
  127. {
  128. label: '365天',
  129. value: '365',
  130. },
  131. ],
  132. },
  133. {
  134. label: '未购买',
  135. type: 'select',
  136. mode: 'cell', // button -按钮类型 cell-表格类型
  137. field: 'notPurchased',
  138. child: [{
  139. label: '未购买',
  140. value: '1',
  141. }, ],
  142. },
  143. {
  144. label: '排序',
  145. type: 'select',
  146. mode: 'cell',
  147. min: 1,
  148. max: 1,
  149. field: 'sort',
  150. child: [{
  151. label: '业务员',
  152. value: '1',
  153. },
  154. {
  155. label: '客户',
  156. value: '2',
  157. },
  158. {
  159. label: '地址',
  160. value: '3',
  161. },
  162. {
  163. label: '日期',
  164. value: '4',
  165. },
  166. ],
  167. },
  168. ],
  169. popupShow: false,
  170. // 列表的参数
  171. dataList: [],
  172. mask: false,
  173. total: 0,
  174. keyName: 'cname',
  175. status: 'loadmore',
  176. // 请求的参数
  177. form: {
  178. current: 1,
  179. size: 10,
  180. sort: 1,
  181. days: 30,
  182. endDays: 59,
  183. notPurchased:null
  184. },
  185. tabsList: [{
  186. dictKey: 1,
  187. dictValue: '业务员优先'
  188. }, {
  189. dictKey: 2,
  190. dictValue: '客户优先'
  191. }, {
  192. dictKey: 3,
  193. dictValue: '地址优先'
  194. }],
  195. current: 0,
  196. scrollTop: 0
  197. }
  198. },
  199. onLoad() {
  200. // this.form.sort = "S"
  201. this.dataList = []
  202. this.getList()
  203. },
  204. onReachBottom() {
  205. this.status = 'loading'
  206. if (this.dataList.length < this.total) {
  207. this.form.current++
  208. this.getList()
  209. } else {
  210. this.status = 'nomore'
  211. }
  212. },
  213. onPageScroll(e) {
  214. this.scrollTop = e.scrollTop;
  215. },
  216. methods: {
  217. shfilterChange(val) {
  218. console.log(val)
  219. if (val.days&&val.days.length) {
  220. if (val.days[0] == 30) {
  221. this.form.days = val.days[0]
  222. this.form.endDays = 59
  223. }
  224. if (val.days[0] == 60) {
  225. this.form.days = val.days[0]
  226. this.form.endDays = 119
  227. }
  228. if (val.days[0] == 120) {
  229. this.form.days = val.days[0]
  230. this.form.endDays = 364
  231. }
  232. if (val.days[0] == 365) {
  233. this.form.days = val.days[0]
  234. this.form.endDays = null
  235. }
  236. } else {
  237. this.form.days = 30
  238. this.form.endDays = 59
  239. }
  240. if (val.notPurchased&&val.notPurchased.length) {
  241. this.form.notPurchased = 1
  242. } else {
  243. this.form.notPurchased = null
  244. }
  245. if (val.sort&&val.sort.length) {
  246. this.form.sort = val.sort[0]
  247. } else {
  248. this.form.sort = 1
  249. }
  250. this.form.current = 1
  251. this.dataList = []
  252. this.getList()
  253. },
  254. inPage(row) {
  255. console.log(row)
  256. uni.$u.route('/pages/views/customerAnalysis/details', {
  257. id: row.id
  258. });
  259. },
  260. custom() {
  261. this.form.current = 1
  262. this.dataList = []
  263. this.getList()
  264. },
  265. getList() {
  266. uni.showLoading({
  267. title: '加载中',
  268. mask: true
  269. });
  270. getList(this.form).then(res => {
  271. if (res.data.length == 0) {
  272. this.dataList = []
  273. this.total = 0
  274. } else {
  275. this.total = res.data.total || 0
  276. this.dataList = this.dataList.concat(res.data.records)
  277. }
  278. uni.hideLoading();
  279. if (this.total < 10) {
  280. this.status = 'nomore'
  281. }
  282. // this.getViewHeight()
  283. })
  284. },
  285. // tabs切换
  286. tabsClick(item) {
  287. this.current = item.index
  288. this.form.sort = item.dictKey
  289. this.form.current = 1
  290. this.dataList = []
  291. this.getList()
  292. },
  293. popupClose() {
  294. this.popupShow = false
  295. },
  296. submit() {
  297. this.popupShow = false
  298. this.form.current = 1
  299. this.dataList = []
  300. this.getList()
  301. },
  302. reset() {
  303. this.form.sort = 1
  304. this.form.notPurchased = null
  305. }
  306. }
  307. }
  308. </script>
  309. <style lang="scss" scoped>
  310. .tabFilter {
  311. display: flex;
  312. align-items: center;
  313. background-color: #FFFFFF;
  314. height: 36px;
  315. width: 100%;
  316. box-shadow: 0 0 4px 2px rgba($color: #000000, $alpha: 0.06);
  317. }
  318. .contentBox {
  319. width: 96%;
  320. margin: 20rpx auto;
  321. background-color: #FFFFFF;
  322. border-radius: 20rpx;
  323. padding-top: 15rpx;
  324. padding-bottom: 10rpx;
  325. }
  326. .textBox {
  327. padding: 0 15px;
  328. display: flex;
  329. justify-content: space-between;
  330. font-size: 28rpx;
  331. margin-bottom: 10rpx;
  332. }
  333. .textBox-text {
  334. width: 400rpx;
  335. overflow: hidden;
  336. white-space: nowrap;
  337. text-overflow: ellipsis;
  338. }
  339. .dropdown {
  340. position: absolute;
  341. z-index: 9;
  342. background: rgba(0, 0, 0, .3);
  343. width: 100%;
  344. left: 0;
  345. top: calc(var(--status-bar-height) + 90px);
  346. bottom: 0;
  347. }
  348. .tl-show {
  349. overflow: hidden;
  350. position: fixed;
  351. height: 100%;
  352. width: 100%;
  353. }
  354. .tabClass {
  355. display: flex;
  356. flex-direction: row;
  357. flex-wrap: wrap;
  358. padding: 0 20rpx 10rpx;
  359. }
  360. </style>