cardList.vue 9.6 KB

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