home.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="content">
  3. </view>
  4. </template>
  5. <script>
  6. import {
  7. initGet,
  8. getFeatureItemList,
  9. isHaveExperienceCard,
  10. followOrderManager,
  11. setRedPageNum,
  12. getMarketingShopInfo
  13. } from '../../api/home'
  14. export default {
  15. data() {
  16. return {
  17. url: 'http://192.168.0.215:9588',
  18. followSize: '',
  19. servicesSize: '',
  20. sweepCodebth: false,
  21. redData: {},
  22. experienceCard:'',
  23. redEnvelopes: false,
  24. marketingShopInfo: {},
  25. snapUpItem: {},
  26. featureItemlists: [],
  27. vipCardList: [],
  28. hotItemlist: [],
  29. newItemlist: [],
  30. voucherList: [],
  31. orderManagerList: [],
  32. scoreList: [],
  33. groupItem: {},
  34. demo01_index: 1,
  35. yishouXianliang: 0,
  36. show: false,
  37. loadings: false,
  38. title: '恭喜',
  39. text: '加载中',
  40. memberItemList: [],
  41. demo01_list: [],
  42. openTeSe: true,
  43. needdata: '',
  44. options: {
  45. orderTime: ''
  46. },
  47. items: [
  48. { key: '资质认证' },
  49. { key: '优质商家' },
  50. { key: '品质保证' },
  51. { key: '品质保障' }
  52. ],
  53. percent1: 0,
  54. // 门店信息
  55. marketingInfo: {},
  56. popupSHow:false,
  57. defaultImg: require("../../static/homeImg/pic_def.png"),
  58. defaultImg2: require("../../static/homeImg/pic_def2.png")
  59. }
  60. },
  61. onLoad() {
  62. var that=this;
  63. var params={ lat:'',lng:'',}
  64. uni.getLocation({
  65. type: 'wgs84',
  66. geocode:true,//设置该参数为true可直接获取经纬度及城市信息
  67. success: function (res) {
  68. console.log(res)
  69. params.lat=res.latitude
  70. params.lng=res.longitude
  71. that.init(params)
  72. },
  73. fail: function () {
  74. params.lat=res.latitude
  75. params.lng=res.longitude
  76. that.init(params)
  77. }
  78. });
  79. //console.log(this.$request.fetchGet)
  80. /* this.$request.fetchGet('home/getFeatureItemList', {
  81. }).then(res => {
  82. })
  83. getFeatureItemList().then(res => {
  84. }) */
  85. },
  86. methods: {
  87. init (params) {
  88. //alert(params.shopId)
  89. this.loadings = true
  90. initGet(params).then(res => {
  91. this.loadings = false
  92. this.needdata = res.data;
  93. //return false
  94. this.experienceCard = res.data.experienceCard
  95. // 头部部分 门店信息
  96. this.marketingShopInfo = res.data.marketingShopInfo
  97. // 轮播图
  98. this.demo01_list = []
  99. if (this.marketingShopInfo.shopPhotos) {
  100. this.marketingShopInfo.shopPhotos.forEach(item => {
  101. this.demo01_list.push({
  102. url: 'javascript:',
  103. img: item.photoPath
  104. })
  105. })
  106. }
  107. if(this.marketingShopInfo.shopPhotos.length==0){
  108. this.demo01_list.push({
  109. url: 'javascript:',
  110. img: 'http://phone.66km.cn:8088/thFiles/1175E99A-BB94-43CC-8B00-7E3ECA8EB355.png'
  111. })
  112. }
  113. /* this.demo01_list.push({
  114. url: 'javascript:',
  115. img: 'http://phone.66km.cn:8088/marketing/8EF7F827-91E3-4A51-8244-21DA15FDA34E.jpeg'
  116. }) */
  117. // 限量抢购(1个)
  118. if (res.data.snapUpItem) {
  119. this.snapUpItem = res.data.snapUpItem
  120. // 已售的 百分数
  121. if(this.snapUpItem.buyCount<0){
  122. this.snapUpItem.buyCount=-this.snapUpItem.buyCount
  123. }
  124. this.yishouXianliang = ((this.snapUpItem.buyCount / this.snapUpItem.count).toFixed(2)) * 100
  125. this.percent1 = ((this.snapUpItem.buyCount / this.snapUpItem.count).toFixed(2)) * 100 || 0
  126. }
  127. // 特色项目列表
  128. if (res.data.featureItemlist && res.data.featureItemlist.length) {
  129. this.featureItemlists = res.data.featureItemlist
  130. }
  131. // vip 会员卡
  132. if (res.data.vipCardList && res.data.vipCardList.length) {
  133. this.vipCardList = res.data.vipCardList
  134. }
  135. // 热门项目
  136. if (res.data.hotItemlist && res.data.hotItemlist.length) {
  137. this.hotItemlist = res.data.hotItemlist
  138. }
  139. // 最新项目
  140. if (res.data.newItemlist && res.data.newItemlist.length) {
  141. this.newItemlist = res.data.newItemlist
  142. }
  143. // 领取优惠
  144. if (res.data.voucherList && res.data.voucherList.length) {
  145. this.voucherList = res.data.voucherList
  146. this.voucherList.forEach(item => {
  147. this.$set(item, 'nowlingqu', '立即领取')
  148. })
  149. }
  150. // 拼团活动
  151. if (res.data.groupItem) {
  152. this.groupItem = res.data.groupItem
  153. }
  154. // 顾客评价
  155. if (res.data.scoreList && res.data.scoreList.length) {
  156. this.scoreList = res.data.scoreList
  157. }
  158. if (res.data.orderManagerList && res.data.orderManagerList.length) {
  159. this.orderManagerList = res.data.orderManagerList
  160. }
  161. this.followSize = res.data.followSize
  162. this.servicesSize = res.data.servicesSize
  163. // 会员专区
  164. if (res.data.memberItemList && res.data.memberItemList.length) {
  165. this.memberItemList = res.data.memberItemList
  166. }
  167. if (res.data.noHaveRedEnvelopesFlag === '1') {
  168. this.redEnvelopes = true
  169. let json = {
  170. redEnvelopesId: res.data.redEnvelopesId
  171. }
  172. // this.redData = {
  173. // redEnvelopesId: '0C6BD78E-AE07-4D4C-96FF-69A3986980F2'
  174. // }
  175. setRedPageNum(json).then(res => {
  176. if (!res.code) {
  177. this.redData = res.data
  178. }
  179. // console.log(this.redData )
  180. }).catch(err => {
  181. console.log(err)
  182. })
  183. }
  184. // this.$refs.viewBox.scrollTo(this.$store.state.user.SetScrollTop)
  185. }).catch(err => {
  186. this.loadings = false
  187. console.log(err)
  188. })
  189. },
  190. }
  191. }
  192. </script>
  193. <style>
  194. </style>