index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="peripheralService">
  3. <div class="peripheralBody">
  4. <van-tabs :active="active" @change="selectChange">
  5. <van-tab title="全部" :name="all"></van-tab>
  6. <van-tab :title="item.label" :name="item.value" v-for="item in serviceList"></van-tab>
  7. <!-- <van-tab title="干洗" :name="1"></van-tab>-->
  8. <!-- <van-tab title="维修" :name="2"></van-tab>-->
  9. <!-- <van-tab title="保洁" :name="3"></van-tab>-->
  10. <!-- <van-tab title="精装水" :name="4"></van-tab>-->
  11. <!-- <van-tab title="医疗" :name="5"></van-tab>-->
  12. </van-tabs>
  13. <div class="peripheralBox">
  14. <div class="peripheralItem" v-for="item in peripheralList" @tap="toDetail(item)">
  15. <div class="peripheralItemRow1">
  16. <span class="peripheralName">{{item.businessName}}</span>
  17. <span class="periTag">{{item.type}}</span>
  18. </div>
  19. <div class="peripheralItemRow2">入驻时间:{{item.releaseTime}}</div>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { getByCodes,peripheryList } from "@/js_sdk/http";
  27. export default {
  28. name: "peripheralService",
  29. data(){
  30. return {
  31. dc_key: ['periphery_type', 'QUICK_SELECTION'],
  32. active: 0,
  33. type: '',
  34. peripheralList:[
  35. // {name:'福奈特洗衣店(基金PARK店)',type:'干洗'},
  36. // {name:'印彩图文广告(金融街店)',type:'打印'},
  37. ],
  38. params: {
  39. pageNum: 1,
  40. pageSize: 10,
  41. releaseType: 'periphery',
  42. status: 'published'
  43. },
  44. serviceList:[],
  45. dic_SelectList:[],
  46. all: null
  47. }
  48. },
  49. created(){
  50. this.getByCodes()
  51. },
  52. onPullDownRefresh() {
  53. this.getByCodes()
  54. setTimeout(function () {
  55. uni.stopPullDownRefresh();
  56. }, 1000);
  57. },
  58. methods:{
  59. async getByCodes() {
  60. let data = await getByCodes(JSON.stringify(this.dc_key));
  61. this.dic_SelectList = this.$common.handleDicList(data);
  62. this.serviceList = this.dic_SelectList.periphery_type
  63. // console.log('this.serviceList',this.serviceList)
  64. this.selectChange({detail:{
  65. name:''
  66. }})
  67. },
  68. selectData(type) {
  69. const _this = this
  70. _this.params.type = type
  71. peripheryList(_this.params).then((res) => {
  72. if (res.data) {
  73. res.data.forEach(function(item) {
  74. const jsonMap = _this.getItemJson(item)
  75. // console.log('jsonMap',jsonMap)
  76. _this.peripheralList.push(jsonMap)
  77. })
  78. }
  79. // console.log(_this.peripheralList)
  80. })
  81. },
  82. selectChange(e) {
  83. console.log(e)
  84. this.peripheralList = []
  85. this.selectData(e.detail.name)
  86. },
  87. toDetail(item) {
  88. uni.navigateTo({
  89. url:'/pages/subPackages/peripheralService/detail?id='+item.id
  90. })
  91. },
  92. getItemJson: function(item) {
  93. item.releaseTime = this.$common.transDate(item.releaseTime)
  94. // item.type = this.dic_SelectList.periphery_type[item.type]
  95. let transformedObject = this.dic_SelectList.periphery_type.reduce((acc, obj) => {
  96. acc[obj.value] = obj.label;
  97. return acc;
  98. }, {'':'全部'});
  99. item.type = transformedObject[item.type]
  100. // console.log('this.dic_SelectList.periphery_type',transformedObject)
  101. return item
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss">
  107. .peripheralService{
  108. .peripheralBody{
  109. background: white;
  110. margin-top: 24rpx;
  111. padding: 32rpx;
  112. box-sizing: border-box;
  113. height: 1424rpx;
  114. .peripheralBox{
  115. margin-top: 8rpx;
  116. .peripheralItem{
  117. width: 686rpx;
  118. height: 172rpx;
  119. box-sizing: border-box;
  120. border-radius: 16rpx;
  121. background: #F5F7FA;
  122. padding: 32rpx;
  123. margin-top: 24rpx;
  124. .peripheralItemRow1{
  125. display: flex;
  126. justify-content: space-between;
  127. .peripheralName{
  128. color:#222222;
  129. font-size: 32rpx;
  130. font-weight: 600;
  131. }
  132. .periTag{
  133. display: flex;
  134. align-items: center;
  135. justify-content: center;
  136. width: 92rpx;
  137. height: 48rpx;
  138. background: rgba(3, 101, 249, 0.20);
  139. color: rgba(3, 101, 249, 1);
  140. border-radius: 8rpx;
  141. font-size: 24rpx;
  142. }
  143. }
  144. .peripheralItemRow2{
  145. color: #888888;
  146. font-size: 28rpx;
  147. margin-top: 20rpx;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </style>