cardList.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <view>
  3. <view class="top-fixed">
  4. <view class="search-box ddflex">
  5. <view class="search-input ddflex fflex">
  6. <image src="/static/images/ssico.png"></image>
  7. <input @confirm="searchFn" confirm-type="search" @input="searchFn" v-model="searchVal" class="fflex"
  8. placeholder="请输入代理人姓名" />
  9. </view>
  10. </view>
  11. <view class="filter ddflex">
  12. <view :class="'filter-item fflex ddflex '+(dateIndex!=-1?'f-active':'')" @click="changeFilterType(1)">
  13. {{dateIndex!=-1?dateList[dateIndex].label:'智能筛选'}}
  14. <image class="filter-item-icon" :style="filterType==1&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  15. </view>
  16. <view :class="'filter-item fflex ddflex '+(areaIndex!=-1?'f-active':'')" @click="changeFilterType(1)">
  17. {{areaIndex!=-1?areaList[areaIndex].label:'全国'}}
  18. <image class="filter-item-icon" :style="filterType==1&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  19. </view>
  20. <view :class="'filter-item fflex ddflex '+(stateIndex!=-1?'f-active':'')" @click="changeFilterType(2)">
  21. {{stateIndex!=-1?stateList[stateIndex].label:'筛选'}}
  22. <image class="filter-item-icon" :style="filterType==2&&isShowPop?'transform: rotate(180deg);':''" src="../static/images/down.png"></image>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="ceng" v-if="isShowPop" @click="hidePop()"></view>
  27. <view class="hx-pop" :style="'top:calc(' +popBottom+' + '+(isShowPop?190:0)+'rpx' ">
  28. <view class="pop-con" v-if="filterType==1">
  29. <view class="pop-list ddflex">
  30. <view :class="'li' + (dateIndex == index ? ' active' : '')" v-for="(item, index) in dateList" :key="index" @click="switchType(index)">{{ item.label }}</view>
  31. </view>
  32. <view class="pop-time ddflex">
  33. <picker mode="date" class="date-ipt" @change="changeStartTime">
  34. <view :class="startTime ? '' : 'placeholder'">{{ startTime ? startTime : '选择日期' }}</view>
  35. </picker>
  36. <text>至</text>
  37. <picker mode="date" class="date-ipt" @change="changeEndTime">
  38. <view :class="endTime ? '' : 'placeholder'">{{ endTime ? endTime : '选择日期' }}</view>
  39. </picker>
  40. </view>
  41. </view>
  42. <view class="pop-con" v-if="filterType==2">
  43. <view class="pop-list ddflex">
  44. <view :class="'li' + (stateIndex == index ? ' active' : '')" v-for="(item, index) in stateList" :key="index" @click="switchType(index)">{{ item.label }}</view>
  45. </view>
  46. </view>
  47. <view class="pop-btn ddflex">
  48. <view @click="reset">重置</view>
  49. <view class="fflex" @click="confirm">确定</view>
  50. </view>
  51. </view>
  52. <view style="height: 190rpx;"></view>
  53. <!-- 订单列表 -->
  54. <view style="position: relative;overflow: hidden;" v-if="dataList.length>0">
  55. <view class="register-box" v-for="item,index in dataList" :key="index" @click="jumpUrl('/card/cardDetail/cardDetail')">
  56. <view class="register-title ddflex fflex" @click.stop="jumpUrl('/card/cardDetail/cardDetail')">
  57. <image class="register-title-icon" :src="item.avatar?item.avatar:'/static/images/userimg.png'"></image>
  58. <view class="flex" style="min-width: 0;">
  59. <view class="ddflex">
  60. <view class="card-name fflex tover">{{item.nickName?item.nickName:'杜平'}}</view>
  61. <image style="width: 64rpx;height: 64rpx;margin-left: 10rpx;" src="../static/images/wxth.png"></image>
  62. </view>
  63. <view class="ddflex" style="margin-top: 4rpx;">
  64. <view class="card-tag">高级组经理</view>
  65. <view class="card-tag">入司10年</view>
  66. </view>
  67. <view class="card-area ddflex">
  68. <image src="/static/pages/images/dzico.png"></image>
  69. <view class="flex tover">中电软件园中电软件园中电软件园中电软件园</view>
  70. <view style="color: #A1A1A1;margin-left: 10rpx;">距离5.23km</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="ddflex" style="margin-top: 41rpx;">
  75. <view class="flex">
  76. <view class="card-data">1678</view>
  77. <view class="card-label">服务客户</view>
  78. </view>
  79. <view class="card-line"></view>
  80. <view class="flex">
  81. <view class="card-data">1678</view>
  82. <view class="card-label">保单件数</view>
  83. </view>
  84. <view class="card-line"></view>
  85. <view class="flex">
  86. <view class="card-data">1678</view>
  87. <view class="card-label">用户评价</view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view v-else class="nodata">
  93. <image src="../../card/static/images/empty.png" mode="widthFix"></image>
  94. <view>暂无数据</view>
  95. </view>
  96. </view>
  97. </template>
  98. <script>
  99. const app = getApp();
  100. const req = require("../../utils/request.js");
  101. export default {
  102. components: {},
  103. props: {},
  104. data() {
  105. return {
  106. statusBarHeight:0,
  107. filterType:null,
  108. popBottom: '-100%',
  109. isShowPop: false,
  110. dateIndex: -1,
  111. // 时间类型 1、今日 2、昨日 3、近7日 4、近30天 5、本月 6、本季度 7、本年度
  112. dateList: [
  113. {
  114. label: '今日',
  115. value: 1
  116. },
  117. {
  118. label: '昨日',
  119. value: 2
  120. },
  121. {
  122. label: '近7日',
  123. value: 3
  124. },
  125. {
  126. label: '近30天',
  127. value: 4
  128. },
  129. {
  130. label: '本月',
  131. value: 5
  132. },
  133. {
  134. label: '本季度',
  135. value: 6
  136. },
  137. {
  138. label: '本年度',
  139. value: 7
  140. }
  141. ],
  142. startTime: '',
  143. endTime: '',
  144. stateIndex: -1,
  145. stateList:[{
  146. label: '开通成功',
  147. value: 7
  148. },
  149. {
  150. label: '待支付',
  151. value: 1
  152. },
  153. {
  154. label: '取消支付',
  155. value: 8
  156. }],
  157. page: 1,
  158. limit: 10,
  159. isLoad: true,
  160. searchVal: '',
  161. dataList: [],
  162. isReference:false
  163. }
  164. },
  165. onLoad(options) {
  166. this.getDataList()
  167. },
  168. onShow() {
  169. if(this.isReference){
  170. this.isReference = false
  171. this.page=1;
  172. this.isLoad = true
  173. this.getDataList();
  174. }
  175. },
  176. onReachBottom() {
  177. this.page++;
  178. this.getDataList();
  179. },
  180. methods: {
  181. jumpUrl(url) {
  182. uni.navigateTo({
  183. url: url
  184. })
  185. },
  186. // 切换筛选类型
  187. changeFilterType(type){
  188. this.openPop()
  189. if(this.filterType==type) return false
  190. this.filterType = type
  191. },
  192. // 打开弹窗
  193. openPop(){
  194. this.isShowPop = true
  195. this.popBottom = '0%'
  196. },
  197. // 关闭弹窗
  198. hidePop() {
  199. this.isShowPop = false;
  200. this.popBottom = '-100%';
  201. },
  202. // 筛选
  203. switchType(index) {
  204. if(this.filterType==1){
  205. if (this.dateIndex == index) return false;
  206. this.dateIndex = index;
  207. this.startTime = '';
  208. this.endTime = '';
  209. }else{
  210. if (this.stateIndex == index) return false;
  211. this.stateIndex = index;
  212. }
  213. },
  214. changeStartTime(e) {
  215. const endTime = new Date(this.endTime);
  216. const startTime = new Date(e.detail.value);
  217. if (endTime.getTime() < startTime.getTime()) {
  218. req.msg('开始时间不能小于结束时间');
  219. return false;
  220. }
  221. this.startTime = e.detail.value;
  222. this.dateIndex = -1;
  223. if(!this.endTime){
  224. this.endTime = this.startTime
  225. }
  226. },
  227. changeEndTime(e) {
  228. const endTime = new Date(e.detail.value);
  229. const startTime = new Date(this.startTime);
  230. if (endTime.getTime() < startTime.getTime()) {
  231. req.msg('结束时间不能小于开始时间');
  232. return false;
  233. }
  234. this.endTime = e.detail.value;
  235. this.dateIndex = -1;
  236. if(!this.startTime){
  237. this.startTime = this.endTime
  238. }
  239. },
  240. confirm() {
  241. this.hidePop();
  242. this.isLoad = true;
  243. this.getDataList();
  244. },
  245. reset() {
  246. this.dateIndex = -1;
  247. this.stateIndex = -1;
  248. this.startTime = '';
  249. this.endTime = '';
  250. },
  251. // 分页查询
  252. getDataList() {
  253. if (!this.isLoad) return false;
  254. this.isLoad = false;
  255. let queryParams = {
  256. page: this.page,
  257. limit: this.limit,
  258. orderType:96,
  259. isAllUser:1,
  260. isOffline:1
  261. }
  262. if (this.searchVal) {
  263. queryParams.search = this.searchVal
  264. }
  265. // 时间筛选
  266. if (this.dateIndex != -1) {
  267. queryParams.dateType = this.dateList[this.dateIndex].value;
  268. }else if (this.dateIndex == -1) {
  269. } else {
  270. queryParams.dateType = 8
  271. queryParams.end = this.endTime?this.endTime:null;
  272. queryParams.start = this.startTime?this.startTime:null;
  273. }
  274. // 状态筛选
  275. if (this.stateIndex != -1) {
  276. queryParams.state = this.stateList[this.stateIndex].value;
  277. }
  278. req.getRequest('/api/order/vipList', queryParams, data => {
  279. data = [1,2]
  280. if (data != null && data.length == this.limit) {
  281. this.isLoad = true;
  282. }
  283. if (this.page == 1) {
  284. this.dataList = [];
  285. }
  286. if (this.page > 0) {
  287. data = this.dataList.concat(data);
  288. }
  289. this.dataList = data;
  290. console.log('列表数据>>>', this.dataList);
  291. })
  292. },
  293. // 搜索
  294. searchFn() {
  295. this.page = 1;
  296. this.isLoad = true;
  297. this.getDataList();
  298. },
  299. formatTimeFn(data) {
  300. if (data) {
  301. return utils.formatTimeCommStr(data, 'Y-M-D')
  302. } else {
  303. return '';
  304. }
  305. },
  306. // 取消订单
  307. quxiao(item){
  308. this.$showModal({
  309. title: '提示',
  310. content: '确定取消订单?',
  311. cancelText: '取消',
  312. confirmText: '确认'
  313. })
  314. .then(res => {
  315. req.postRequest('/api/order/cancel',{id:item.id},res=>{
  316. req.msg('订单已取消')
  317. item.state = 8
  318. })
  319. })
  320. .catch(err => {
  321. });
  322. }
  323. },
  324. mounted() {
  325. const systemInfo = uni.getSystemInfoSync();
  326. // px转换到rpx的比例
  327. let pxToRpxScale = 750 / systemInfo.windowWidth;
  328. this.statusBarHeight = uni.getSystemInfoSync().windowTop*pxToRpxScale
  329. }
  330. }
  331. </script>
  332. <style>
  333. @import "./cardList.css";
  334. </style>