merchant-list.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>列表-我的商户-爽客邦</title>
  6. <meta name="keywords" content="列表-我的商户-爽客邦">
  7. <meta name="description" content="列表-我的商户-爽客邦">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="列表-我的商户-爽客邦">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgcf7f7f7 pb0 vh100">
  18. <div class="vh100" id="app" v-cloak>
  19. <van-sticky>
  20. <van-nav-bar class="camp_title user_title_normal titlef16 whit_icon" left-arrow title="我的商户" v-if="toptitleisshow" @click-left="goback">
  21. <template #left>
  22. <van-icon name="arrow-left" color="#fff"> </van-icon>
  23. </template>
  24. </van-nav-bar>
  25. </van-sticky>
  26. <div class="merchant-header pt16">
  27. <div class="f12 cfff pl16" ref="closedropdown">共5个商户,今日3个商户参与活动</div>
  28. <van-tabs class="merchant-list bgcfff" v-model="active" line-width="20" line-height="2" :ellipsis="false" @click="checktab">
  29. <van-tab class="bgcfff" v-for="merchant,ind in merchantTypes" :title="merchant.Name">
  30. <van-dropdown-menu :overlay="openOverlay ? true : false" active-color="#ff502a" v-if="ind === active">
  31. <van-dropdown-item title="排序" :options="option1" v-model="sortdata" @change="sortbtn"></van-dropdown-item>
  32. <van-dropdown-item :title-class="typeActived == index ? 'no-arrow more' : 'no-arrow'" v-for="item,index in dropdownMenus" :ref="`activeType${index}`" @open="changeActiveType(item,index)">
  33. <template #title>
  34. <div class="f12">{{item.title + '(' + item.count + ')'}}</div>
  35. </template>
  36. </van-dropdown-item>
  37. <van-dropdown-item title="筛选" ref="item" title-class="no-arrow filter-icon">
  38. <template #default>
  39. <div class="pb32 ml16 mr16">
  40. <div class="f12 c333">参与时间</div>
  41. <div class="df mt8 dropdown-button">
  42. <van-button plain v-for="item,index in option" :class="selectedOption == index ? 'dropdown-button__active' : ''" @click="onSelectOption(item,index)">{{item.text}}</van-button>
  43. </div>
  44. </div>
  45. <div class="df dropdown-checkbutton">
  46. <van-button block @click="resetbtn">
  47. <div class="f14 c666">重置</div>
  48. </van-button>
  49. <van-button block @click="surebtn">
  50. <div class="f16 more">确认</div>
  51. </van-button>
  52. </div>
  53. </template>
  54. </van-dropdown-item>
  55. </van-dropdown-menu>
  56. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="merchants.length === 0 ? 'isnodata':''">
  57. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  58. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  59. <van-cell-group :border="false">
  60. <van-cell v-for="item,index in merchants" :title="item.MerchantName" center>
  61. <template #label><span class="mr16">注册时间:{{item.KqRegTime}}</span><span>当月交易额(元):{{item.ThisMonthTrade}}</span></template>
  62. </van-cell>
  63. </van-cell-group>
  64. </van-list>
  65. </van-pull-refresh>
  66. </van-tab>
  67. </van-tabs>
  68. </div>
  69. </div>
  70. <script src="./static/js/klm-vv.min.js"></script>
  71. <script src="./static/js/klm-axios-config.js"></script>
  72. <script>
  73. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  74. // 可以通过下面的方式手动注册
  75. Vue.use(vant.Lazyload);
  76. // 在 #app 标签下渲染一个按钮组件
  77. let app = new Vue({
  78. el: '#app',
  79. data() {
  80. return {
  81. isnodata:false,
  82. toptitleisshow:true,
  83. container:'',
  84. active: 0,
  85. value: 0,
  86. switch1: false,
  87. switch2: false,
  88. selectedOption: 0,
  89. //- 商户参与状态
  90. typeActived: 0,
  91. //- 产品类型id
  92. ProductType:0,
  93. //- 排序类型
  94. sortdata:'trade',
  95. //- 商户数
  96. TotalCount:0,
  97. //- 新增商户数
  98. ActCount:0,
  99. openOverlay: true,
  100. screen:{
  101. min: '',
  102. max: '',
  103. time:''
  104. },
  105. pageinfo:{
  106. PageSize:10,
  107. PageNum:1
  108. },
  109. option1: [
  110. { text: '本月交易额(由高至低)', value: 'trade' },
  111. //- { text: '注册时间(由近及远)', value: 'regdate' },
  112. ],
  113. option: [
  114. { text: '全部', value: '',index:0 },
  115. { text: `${new Date().getFullYear() - 1}年参与`, value: new Date().getFullYear() - 1,index:1 },
  116. { text: `${new Date().getFullYear()}年参与`, value: new Date().getFullYear(),index:2 },
  117. ],
  118. dropdownMenus: [
  119. { title: '全部', count: 5, id: 0},
  120. { title: '已参与', count: 3, id: 1},
  121. { title: '未参与', count: 2, id: 2},
  122. ],
  123. //- 产品类型
  124. merchantTypes: [
  125. ],
  126. //- 商户列表
  127. merchants:[
  128. ],
  129. loading: false,
  130. finished: false,
  131. refreshing: false,
  132. };
  133. },
  134. async created() {
  135. await this.getproductlist();
  136. this.getmerchantlist();
  137. },
  138. methods: {
  139. onLoad() {
  140. if (this.refreshing) {
  141. this.merchants = [];
  142. this.refreshing = false;
  143. this.pageinfo.PageNum = 0;
  144. };
  145. this.pageinfo.PageNum++;
  146. this.getmerchantlist();
  147. },
  148. onRefresh() {
  149. // 清空列表数据
  150. this.finished = false;
  151. // 重新加载数据
  152. // 将 loading 设置为 true,表示处于加载状态
  153. this.loading = true;
  154. this.onLoad();
  155. },
  156. onSelectOption(item,index) {
  157. this.openOverlay = true;
  158. if(item.index == index){
  159. this.selectedOption = index;
  160. }
  161. this.screen.time = item.value;
  162. },
  163. changeActiveType(item,index){
  164. const that = this;
  165. console.log(2222)
  166. that.openOverlay = false;
  167. if(item.id == index){
  168. that.typeActived = index;
  169. setTimeout(function(){
  170. that.$refs[`activeType${index}`][0].toggle();
  171. that.openOverlay = true;
  172. },100)
  173. this.merchants = [];
  174. this.getmerchantlist();
  175. }
  176. },
  177. resetbtn(){
  178. this.screen.min = '';
  179. this.screen.max = '';
  180. this.screen.time = '';
  181. this.selectedOption = 0
  182. },
  183. surebtn(){
  184. this.dropdownMenus[0].count = 0;
  185. this.dropdownMenus[1].count = 0;
  186. this.dropdownMenus[2].count = 0;
  187. this.merchants = [];
  188. this.getmerchantlist();
  189. this.$refs.closedropdown.click();
  190. },
  191. //- 切换排序方式
  192. sortbtn(){
  193. this.merchants = [];
  194. this.getmerchantlist();
  195. },
  196. //- 切换tab栏
  197. checktab(index){
  198. this.merchants = [];
  199. this.ProductType = this.merchantTypes[index].Id
  200. this.getmerchantlist();
  201. },
  202. //- 获取产品列表
  203. async getproductlist(){
  204. const res = await getRequest('/api/v1/kqproducts/list',JSON.stringify({PageSize:20,PageNum:1}));
  205. if(res.status === '1') {
  206. res.data = [{Id:0,Name:'全部'}];
  207. this.merchantTypes = res.data;
  208. this.ProductType = res.data[0].Id;
  209. }
  210. },
  211. //- 获取商户列表
  212. async getmerchantlist(){
  213. PublicLib.ShowLoading({Message:''});
  214. const UserId = PublicLib.getCookieInfo('userId');
  215. console.log({...this.pageinfo,UserId,ActiveStatus:this.typeActived,ProductType:this.ProductType,MinTrade:this.screen.min,MaxTrade:this.screen.max,ActTime:this.screen.time,Sort:this.sortdata});
  216. const res = await getRequest('/api/v1/merchantinfo/mymerchant',JSON.stringify({...this.pageinfo,UserId,ActiveStatus:this.typeActived,ProductType:this.ProductType,MinTrade:this.screen.min,MaxTrade:this.screen.max,ActTime:this.screen.time,Sort:this.sortdata}));
  217. if(res.status !== '1') return tips('获取商户列表失败,请重试!');
  218. PublicLib.HideLoading();
  219. if(res.data.length < this.pageinfo.PageSize) {
  220. this.finished = true;
  221. };
  222. this.merchants.push(...res.data);
  223. if((this.typeActived === 0 && this.screen.time === 2021) || this.screen.time === ''){
  224. this.merchants = [
  225. {
  226. MerchantName: "张晟源2504", //商户姓名
  227. KqRegTime: "2021-12-25", //渠道注册时间
  228. Id: "2", //Id
  229. ThisMonthTrade: "4251.00", //当月交易额
  230. },
  231. {
  232. MerchantName: "惠启航9572", //商户姓名
  233. KqRegTime: "2021-11-19", //渠道注册时间
  234. Id: "2", //Id
  235. ThisMonthTrade: "3851.03", //当月交易额
  236. },
  237. {
  238. MerchantName: "徐涛6841", //商户姓名
  239. KqRegTime: "2021-11-26", //渠道注册时间
  240. Id: "2", //Id
  241. ThisMonthTrade: "3521.50", //当月交易额
  242. },
  243. {
  244. MerchantName: "李春雷8471", //商户姓名
  245. KqRegTime: "2021-12-18", //渠道注册时间
  246. Id: "2", //Id
  247. ThisMonthTrade: "2987.53", //当月交易额
  248. },
  249. {
  250. MerchantName: "谢程7152", //商户姓名
  251. KqRegTime: "2021-11-08", //渠道注册时间
  252. Id: "2", //Id
  253. ThisMonthTrade: "2654.38", //当月交易额
  254. }
  255. ];
  256. this.dropdownMenus[0].count = 5;
  257. this.dropdownMenus[1].count = 3;
  258. this.dropdownMenus[2].count = 2;
  259. } else if((this.typeActived === 1 && this.screen.time === 2021) || this.screen.time === ''){
  260. this.merchants = [
  261. {
  262. MerchantName: "张晟源2504", //商户姓名
  263. KqRegTime: "2021-12-25", //渠道注册时间
  264. Id: "2", //Id
  265. ThisMonthTrade: "4251.00", //当月交易额
  266. },
  267. {
  268. MerchantName: "徐涛6841", //商户姓名
  269. KqRegTime: "2021-11-26", //渠道注册时间
  270. Id: "2", //Id
  271. ThisMonthTrade: "4251.00", //当月交易额
  272. },
  273. {
  274. MerchantName: "谢程7152", //商户姓名
  275. KqRegTime: "2021-11-08", //渠道注册时间
  276. Id: "2", //Id
  277. ThisMonthTrade: "2654.38", //当月交易额
  278. }
  279. ]
  280. }else if((this.typeActived === 2 && this.screen.time === 2021) || this.screen.time === ''){
  281. this.merchants = [
  282. {
  283. MerchantName: "惠启航9572", //商户姓名
  284. KqRegTime: "2021-11-19", //渠道注册时间
  285. Id: "2", //Id
  286. ThisMonthTrade: "4251.00", //当月交易额
  287. },
  288. {
  289. MerchantName: "李春雷8471", //商户姓名
  290. KqRegTime: "2021-12-18", //渠道注册时间
  291. Id: "2", //Id
  292. ThisMonthTrade: "2987.53", //当月交易额
  293. },
  294. ]
  295. };
  296. if(this.merchants.length === 0) {this.isnodata = true}else{this.isnodata = false};
  297. this.TotalCount = res.other.TotalCount;
  298. this.ActCount = res.other.ActCount;
  299. this.loading = false;
  300. },
  301. //- 进入搜索
  302. gosearch(){
  303. PublicLib.Goto({Url:'merchant-search'});
  304. },
  305. goback(){
  306. PublicLib.GoBack({Level:1});
  307. },
  308. merchantdetail(id){
  309. PublicLib.putCookieInfo('merchantId', id);
  310. PublicLib.Goto({Url:'merchant-detail'});
  311. }
  312. }
  313. });
  314. </script>
  315. </body>
  316. </html>