merchant-list.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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 ovh">
  18. <div class="iphonetitle"></div>
  19. <div class="detail-pos" id="app" v-cloak>
  20. <van-sticky>
  21. <van-nav-bar class="camp_title user_title_normal titlef16 whit_icon" left-arrow title="我的商户" v-if="toptitleisshow" @click-left="goback" @click-right="gosearch">
  22. <template #left>
  23. <van-icon name="arrow-left"> </van-icon>
  24. </template>
  25. <template #right>
  26. <van-icon class="title_righticon" name="search"> </van-icon>
  27. </template>
  28. </van-nav-bar>
  29. </van-sticky>
  30. <div class="merchant-header pt16">
  31. <div class="f12 c333 pl16 mb20" ref="closedropdown">共{{TotalCount}}个商户,今日激活{{ActCount}}个商户</div>
  32. <van-tabs class="merchant-list bgcfff" v-model="active" line-width="20" line-height="2" :ellipsis="false" swipeable @change="checktab">
  33. <van-tab class="bgcfff" v-for="merchant,ind in merchantTypes" :title="merchant.Name"></van-tab>
  34. <div class="merchant-list bgcfff">
  35. <div class="bgcfff">
  36. <van-dropdown-menu :overlay="openOverlay ? true : false" active-color="#ff502a" v-if="true">
  37. <van-dropdown-item title="排序" :options="option1" v-model="sortdata" @change="sortbtn"></van-dropdown-item>
  38. <van-dropdown-item v-if="isPos" :title-class="typeActived == index ? 'no-arrow c999 itemcheck' : 'no-arrow c999'" v-for="item,index in dropdownMenus" :ref="`activeType${index}`" @open="changeActiveType(item,index)">
  39. <template #title>
  40. <div class="f12">{{item.title + '(' + item.count + ')'}}</div>
  41. </template>
  42. </van-dropdown-item>
  43. <van-dropdown-item title="筛选" ref="item" title-class="no-arrow filter-icon">
  44. <template #default>
  45. <div class="pt16 pb32 ml16 mr16">
  46. <div class="f12 c333">本月交易额(元)</div>
  47. <div class="df mt8 dropdown-input">
  48. <div class="flex1">
  49. <input class="tc" type="number" placeholder="最低值" v-model="screen.min">
  50. </div>
  51. <div class="dropdown-input-split tc">——</div>
  52. <div class="flex1">
  53. <input class="tc" type="number" placeholder="最高值" v-model="screen.max">
  54. </div>
  55. </div>
  56. </div>
  57. <div class="pb32 ml16 mr16">
  58. <div class="f12 c333">激活时间</div>
  59. <div class="df mt8 dropdown-button">
  60. <van-button plain v-for="item,index in option" :class="selectedOption == index ? 'dropdown-button__active' : ''" @click="onSelectOption(item,index)">{{item.text}}</van-button>
  61. </div>
  62. </div>
  63. <div class="df dropdown-checkbutton">
  64. <van-button block @click="resetbtn">
  65. <div class="f14 c666">重置</div>
  66. </van-button>
  67. <van-button block @click="surebtn">
  68. <div class="f16 more">确认</div>
  69. </van-button>
  70. </div>
  71. </template>
  72. </van-dropdown-item>
  73. </van-dropdown-menu>
  74. </div>
  75. <div class="merchant_active">
  76. <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="merchants.length === 0 ? 'isnodata':''" style="height:calc(100vh - 5.4667rem) !important;min-height:50vh;">
  77. <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
  78. <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
  79. <van-cell-group :border="false">
  80. <van-cell v-for="item,index in merchants" :title="item.MerchantName" is-link center @click="merchantdetail(item.Id)">
  81. <template #label><span class="mr16">注册时间:{{item.KqRegTime}}</span><span>当月交易额(元):{{abs(item.ThisMonthTrade)}}</span></template>
  82. </van-cell>
  83. </van-cell-group>
  84. </van-list>
  85. </van-pull-refresh>
  86. </div>
  87. </div>
  88. </van-tabs>
  89. </div>
  90. </div>
  91. <script src="./static/js/klm-vv.min.js"></script>
  92. <script src="./static/js/appfunc.min.js"></script>
  93. <script src="./static/js/klm-axios-config.js"></script>
  94. <script src="./static/js/publicfn.js"></script>
  95. <script>
  96. function OnStart(){
  97. app.getsuerinfo();
  98. PublicLib.SetStatusBarStyle({type:'light', isShow:1});
  99. };
  100. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  101. // 可以通过下面的方式手动注册
  102. Vue.use(vant.Lazyload);
  103. //--- PublicLib.SetStatusBarStyle({type:'light', isShow:1});
  104. // 在 #app 标签下渲染一个按钮组件
  105. let app = new Vue({
  106. el: '#app',
  107. data() {
  108. return {
  109. isPos:true,
  110. isnodata:true,
  111. toptitleisshow:true,
  112. container:'',
  113. active: 0,
  114. value: 0,
  115. switch1: false,
  116. switch2: false,
  117. selectedOption: 0,
  118. //- 商户激活状态
  119. typeActived: 0,
  120. //- 产品类型id
  121. ProductType:0,
  122. //- 排序类型
  123. sortdata:'trade',
  124. //- 商户数
  125. TotalCount:0,
  126. //- 新增商户数
  127. ActCount:0,
  128. openOverlay: true,
  129. screen:{
  130. min: '',
  131. max: '',
  132. time:''
  133. },
  134. pageinfo:{
  135. PageSize:20,
  136. PageNum:1
  137. },
  138. option1: [
  139. { text: '本月交易额(由高至低)', value: 'trade' },
  140. { text: '注册时间(由近及远)', value: 'regdate' },
  141. ],
  142. option: [
  143. { text: '全部', value: '',index:0 },
  144. { text: `${new Date().getFullYear() - 1}年激活`, value: new Date().getFullYear() - 1,index:1 },
  145. { text: `${new Date().getFullYear()}年激活`, value: new Date().getFullYear(),index:2 },
  146. ],
  147. dropdownMenus: [
  148. { title: '全部', count: 0, id: 0},
  149. { title: '已激活', count: 0, id: 1},
  150. { title: '未激活', count: 0, id: 2},
  151. ],
  152. //- 产品类型
  153. merchantTypes: [
  154. ],
  155. //- 商户列表
  156. merchants:[
  157. ],
  158. loading: false,
  159. finished: false,
  160. refreshing: false,
  161. };
  162. },
  163. created() {
  164. this.getproductlist();
  165. },
  166. methods: {
  167. onLoad() {
  168. this.pageinfo.PageNum++;
  169. if(this.active < this.poslength){
  170. this.getPosmerchantlist();
  171. }else{
  172. this.getmerchantsnlist();
  173. };
  174. },
  175. onRefresh() {
  176. // 清空列表数据
  177. this.finished = false;
  178. // 重新加载数据
  179. // 将 loading 设置为 true,表示处于加载状态
  180. this.loading = true;
  181. this.pageinfo.PageNum = 1;
  182. if(this.active < this.poslength){
  183. this.getPosmerchantlist('refresh');
  184. }else{
  185. this.getmerchantsnlist('refresh');
  186. };
  187. },
  188. onSelectOption(item,index) {
  189. this.openOverlay = true;
  190. if(item.index == index){
  191. this.selectedOption = index;
  192. }
  193. this.screen.time = item.value;
  194. },
  195. changeActiveType(item,index){
  196. const that = this;
  197. that.openOverlay = false;
  198. if(item.id == index){
  199. that.typeActived = index;
  200. setTimeout(function(){
  201. that.$refs[`activeType${index}`][0].toggle();
  202. that.openOverlay = true;
  203. },100);
  204. //- this.merchants = [];
  205. this.getPosmerchantlist('refresh');
  206. };
  207. },
  208. resetbtn(){
  209. this.screen.min = '';
  210. this.screen.max = '';
  211. this.screen.time = '';
  212. this.selectedOption = 0;
  213. },
  214. surebtn(){
  215. //- this.merchants = [];
  216. if(this.active < this.poslength){
  217. this.getPosmerchantlist('refresh');
  218. }else{
  219. this.getmerchantsnlist('refresh');
  220. };
  221. this.$refs.closedropdown.click();
  222. },
  223. //- 切换排序方式
  224. sortbtn(){
  225. //- this.merchants = [];
  226. if(this.active < this.poslength){
  227. this.getPosmerchantlist('refresh');
  228. }else{
  229. this.getmerchantsnlist('refresh');
  230. };
  231. },
  232. //- 切换tab栏
  233. checktab(index){
  234. this.merchants = [];
  235. this.pageinfo.PageNum = 1;
  236. this.ProductType = this.merchantTypes[index].Id;
  237. if(this.active < this.poslength){
  238. //- 走pos接口
  239. this.getPosmerchantlist('refresh');
  240. this.isPos = true;
  241. }else{
  242. //- 走sn接口
  243. this.getmerchantsnlist('refresh');
  244. this.isPos = false;
  245. };
  246. },
  247. //- 获取产品列表
  248. // 增加接口,增加POS机板块业务
  249. async getproductlist(){
  250. const listtopos = await getRequest('api/v1/pos/kqproducts/list?t='+Math.random(6),JSON.stringify({PageSize:10,PageNum:1}));
  251. if(listtopos.status === '1') {
  252. console.log(listtopos.data);
  253. const productlist = [];
  254. const list = PublicLib.getCookieInfo('productCenterList') ? PublicLib.getCookieInfo('productCenterList') : '[]';
  255. const testarr = JSON.parse(list) ? JSON.parse(list) : [];
  256. const productsnum = listtopos.data.length - testarr.length;
  257. if(productsnum !== 0){
  258. for(let i = productsnum; i > 0; i--){
  259. testarr.push(listtopos.data[listtopos.data.length - i].Id);
  260. };
  261. };
  262. testarr.forEach((num)=>{
  263. listtopos.data.forEach((item,index)=>{
  264. if(item.Id === Number(num)){
  265. productlist.push(item);
  266. };
  267. });
  268. });
  269. this.merchantTypes = productlist;
  270. //- this.merchantTypes.push(...listtopos.data);
  271. this.ProductType = productlist[0].Id;
  272. this.poslength = listtopos.data.length;
  273. this.getPosmerchantlist(1);
  274. };
  275. //- const listtosn = await getRequest('api/v1/kqproducts/list?t='+Math.random(6),JSON.stringify({PageSize:10,PageNum:1}));
  276. //- if(listtosn.status === '1') {
  277. //- this.merchantTypes.push(...listtosn.data);
  278. //- };
  279. },
  280. //- 获取sn商户列表
  281. async getmerchantsnlist(type = '1'){
  282. //- PublicLib.ShowLoading({Message:''});
  283. const UserId = PublicLib.getCookieInfo('userId');
  284. const res = await getRequest('api/v1/merchantinfo/mymerchant?t='+Math.random(6),JSON.stringify({...this.pageinfo,UserId,ActiveStatus:'',ProductType:this.ProductType,MinTrade:this.screen.min,MaxTrade:this.screen.max,ActTime:this.screen.time,Sort:this.sortdata}));
  285. if(res.status !== '1') return tips('获取商户列表失败,请重试!');
  286. //- PublicLib.HideLoading();
  287. if(res.data.length < this.pageinfo.PageSize) {
  288. this.finished = true;
  289. };
  290. res.data.forEach(item=>{
  291. item.ThisMonthTrade = item.ThisMonthTrade.toFixed(2)
  292. });
  293. if(type === 'refresh'){
  294. this.merchants = res.data;
  295. this.refreshing = false;
  296. }else{
  297. this.merchants.push(...res.data);
  298. };
  299. this.TotalCount = res.other.TotalCount;
  300. this.ActCount = res.other.ActCount;
  301. this.dropdownMenus[0].count = res.other.ProductCount;
  302. this.dropdownMenus[1].count = res.other.ProductActCount;
  303. this.dropdownMenus[2].count = res.other.ProductUnActCount;
  304. this.loading = false;
  305. if(this.merchants.length === 0) {this.isnodata = true}else{this.isnodata = false};
  306. },
  307. //- 获取POS商户列表
  308. async getPosmerchantlist(type = '1'){
  309. //- PublicLib.ShowLoading({Message:''});
  310. const UserId = PublicLib.getCookieInfo('userId');
  311. const res = await getRequest('api/v1/pos/merchantinfo/mymerchant?t='+Math.random(6),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}));
  312. if(res.status !== '1') return tips('获取商户列表失败,请重试!');
  313. //- PublicLib.HideLoading();
  314. if(res.data.length < this.pageinfo.PageSize) {
  315. this.finished = true;
  316. };
  317. res.data.forEach(item=>{
  318. item.ThisMonthTrade = item.ThisMonthTrade.toFixed(2)
  319. });
  320. if(type === 'refresh'){
  321. this.merchants = res.data;
  322. this.refreshing = false;
  323. }else{
  324. this.merchants.push(...res.data);
  325. };
  326. this.TotalCount = res.other.TotalCount;
  327. this.ActCount = res.other.ActCount;
  328. this.dropdownMenus[0].count = res.other.ProductCount;
  329. this.dropdownMenus[1].count = res.other.ProductActCount;
  330. this.dropdownMenus[2].count = res.other.ProductUnActCount;
  331. this.loading = false;
  332. if(this.merchants.length === 0) {this.isnodata = true}else{this.isnodata = false};
  333. },
  334. //- 进入搜索
  335. gosearch(){
  336. PublicLib.Goto({Url:'merchant-search'});
  337. },
  338. goback(){
  339. PublicLib.GoBack({Level:1});
  340. },
  341. merchantdetail(id){
  342. PublicLib.putCookieInfo('merchantId', id);
  343. if(this.active < this.poslength){
  344. PublicLib.Goto({Url:'merchant-detail-pos'});
  345. }else{
  346. PublicLib.Goto({Url:'merchant-detail'});
  347. }
  348. }
  349. }
  350. });
  351. </script>
  352. </body>
  353. </html>