index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view class="main">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000"
  5. circular=false>
  6. <swiper-item v-for="item in bannerList" :key="item.id">
  7. <view class="swiper-item" @click="
  8. imgLink(item.model_type, item.model_id, item.url, item.shop_id)
  9. ">
  10. <image class="cover" :src="item.cover" mode="aspectFill"></image>
  11. </view>
  12. </swiper-item>
  13. </swiper>
  14. <image @click="goToRegisterAndAudit()" class="settle" src="/static/entrepreneurshipZone/settle.png"></image>
  15. <view class="service-sys-moudle">
  16. <view class="title-box">服务体系</view>
  17. <view class="content">
  18. <view class="item" v-for="(item,index) in serviceListData" :key="index" @click="goServiceDetail(item)">
  19. <image class="cover" :src="item.cover" mode="aspectFill"></image>
  20. <view class="title">{{item.title}}</view>
  21. <view class="new-price">
  22. <text class="company">¥</text>
  23. <text class="num">{{formatPrice(item.min_sale_price,'int')}}.</text>
  24. <text class="float-num">{{formatPrice(item.min_sale_price,'float')}}</text>
  25. </view>
  26. <view class="old-price">¥ {{item.min_market_price}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="project-list">
  31. <view class="list-title">
  32. 创业政策
  33. </view>
  34. <view class="list">
  35. <view class="item" v-for="(item,index) in listData" :key="index" @click="policyDetail(item)">
  36. <image class="cover" mode="aspectFill" :src="item.thumbnail"></image>
  37. <view class="right">
  38. <view class="desc">
  39. {{item.header}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <u-loadmore :status="loadStatus" />
  46. </view>
  47. </template>
  48. <script>
  49. export default{
  50. data(){
  51. return {
  52. config: {
  53. back: true,
  54. title: '创业专区',
  55. color: '#1a1a1a',
  56. backgroundColor: [1, '#fff'],
  57. statusBarFontColor: 'black'
  58. },
  59. bannerList: [],
  60. pageParams:{
  61. page: 1,
  62. limit: 10
  63. },
  64. listData: [],
  65. loadStatus: 'loadmore',//loading / nomore
  66. serviceListData: []
  67. }
  68. },
  69. onLoad() {
  70. this.getBanner();
  71. this.getList(true);
  72. this.getServiceList();
  73. },
  74. onPullDownRefresh() {
  75. this.getBanner();
  76. this.getList(true);
  77. this.getServiceList();
  78. uni.stopPullDownRefresh();
  79. },
  80. methods:{
  81. getBanner() {
  82. this.$http.get(`/ad/ad/getShopAdByAdL/0/entrepreneurshipzone-banner`, {}, false)
  83. .then((res) => {
  84. this.loading = false;
  85. if (res && res.code == 200) {
  86. this.bannerList = res.list;
  87. }
  88. })
  89. },
  90. /**
  91. * @param {Object} type int或float
  92. */
  93. formatPrice(price,type){
  94. let str = ''
  95. if(type=='int'){
  96. str = String(price).split('.')[0]
  97. }
  98. if(type=='float'){
  99. str = String(price).split('.').length <= 1?'00':(String(price).split('.')[1])
  100. }
  101. return str;
  102. },
  103. //跳转成为商家
  104. goToRegisterAndAudit(){
  105. let token = uni.getStorageSync("apiToken")
  106. if(!token){
  107. uni.navigateTo({
  108. url:"/pages/login/index"
  109. })
  110. }else{
  111. this.$http.get("/yxt/shopapply/shopApplyInfo").then(res=>{
  112. if(res&&res.code==200){
  113. if(res.data==null){
  114. uni.navigateTo({
  115. url: "/pages/user/merchant/registerAndAudit"
  116. })
  117. }else{
  118. uni.navigateTo({
  119. url:"/pages/user/merchant/audit"
  120. })
  121. }
  122. }
  123. })
  124. }
  125. },
  126. getList(isRefresh,needLoading = false) {
  127. let that = this;
  128. if (!isRefresh && this.loadStatus == 'nomore') {
  129. return false;
  130. }
  131. this.pageParams.page = isRefresh ? 1 : this.pageParams.page + 1;
  132. this.listData = isRefresh ? [] : this.listData;
  133. if(needLoading){
  134. uni.showLoading({
  135. title: '努力加载中...',
  136. mask: true
  137. });
  138. }
  139. this.loadStatus = 'loading';
  140. // this.$http.get('/workpolicy/list',this.pageParams)
  141. // .then(res=>{
  142. // if (res.code == 200) {
  143. // let listData = that.listData;
  144. // listData.push(...res.page.list);
  145. // that.listData = listData;
  146. // that.loadStatus = that.listData.length >= res.page.totalCount?'nomore':'loadmore';
  147. // }
  148. // })
  149. // .finally(()=>{
  150. // if(needLoading){
  151. // uni.hideLoading();
  152. // }
  153. // })
  154. },
  155. policyDetail(item){
  156. uni.navigateTo({
  157. url: '/pages/entrepreneurshipZone/policyDetail?id='+item.id
  158. })
  159. },
  160. getServiceList(){
  161. this.$http.get('/goodsareafeature/page',{
  162. page: 1,
  163. limit: 100,
  164. order_type: 1,
  165. order_mode: '',
  166. area_feature: 1
  167. })
  168. .then(res=>{
  169. if (res.code == 200) {
  170. this.serviceListData = res.page.list;
  171. }
  172. })
  173. },
  174. goServiceDetail(item){
  175. uni.navigateTo({
  176. url: `/pages/product/goods/goods?id=${item.goods_id}`
  177. })
  178. },
  179. /**轮播图跳转 */
  180. imgLink(type, id, url, shopid) {
  181. if (type == "goods") {
  182. uni.navigateTo({
  183. url: "/pages/product/goods/goods?id=" + id + "&shopid=" + shopid,
  184. });
  185. } else if (type == "service") {
  186. // uni.navigateTo({
  187. // url: "/pages/product/goods/serviceGood?id=" + id
  188. // });
  189. } else if (type == "point_goods") {
  190. // uni.navigateTo({
  191. // url: "/pages/product/goods/IntegralGood?id=" + id
  192. // });
  193. } else if (type == "url") {
  194. if(/^http/.test(url)){
  195. uni.navigateTo({
  196. url: "/pages/index/webView?linkUrl=" + url,
  197. });
  198. }else{
  199. uni.navigateTo({
  200. url
  201. });
  202. }
  203. }
  204. }
  205. },
  206. onReachBottom(){
  207. this.getList();
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .main{
  213. padding-bottom: 30px;
  214. .swiper{
  215. height: 340rpx;
  216. width: 100%;
  217. .cover{
  218. height: 340rpx;
  219. width: 100%;
  220. }
  221. }
  222. .settle{
  223. height: 156rpx;
  224. width: 690rpx;
  225. margin: 50rpx 30rpx;
  226. }
  227. .project-list{
  228. width: 690rpx;
  229. margin: 0 auto 60rpx auto;
  230. background: #ffffff;
  231. border-radius: 16rpx;
  232. padding: 23rpx 20rpx 0 20rpx;
  233. box-sizing: border-box;
  234. filter: drop-shadow(1px 2px 4px rgba(26,58,70,0.1));
  235. .list-title{
  236. font-size: 36rpx;
  237. font-family: PingFang SC, PingFang SC-Bold;
  238. font-weight: 700;
  239. text-align: left;
  240. color: #1a1a1a;
  241. display: flex;
  242. justify-content: space-between;
  243. align-items: baseline;
  244. padding: 0 0 23rpx 10rpx;
  245. box-sizing: border-box;
  246. border-bottom: 1px solid #e6e6e6;
  247. }
  248. .list{
  249. padding: 15rpx 0;
  250. box-sizing: border-box;
  251. .item{
  252. padding: 45rpx 0;
  253. border-top: 1px solid #e6e6e6;
  254. &:nth-child(1){
  255. border-top: none;
  256. }
  257. .right{
  258. display: inline-block;
  259. .desc{
  260. font-size: 26rpx;
  261. font-family: PingFang SC, PingFang SC-Regular;
  262. font-weight: 400;
  263. text-align: left;
  264. color: #1A1A1A;
  265. line-height: 39rpx;
  266. margin-top: 15rpx;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. display: -webkit-box;
  270. -webkit-box-orient: vertical;
  271. -webkit-line-clamp: 3;
  272. word-break: break-word;
  273. width: 480rpx;
  274. }
  275. }
  276. .cover{
  277. width: 136rpx;
  278. height: 136rpx;
  279. background: rgba(0,0,0,0.00);
  280. border-radius: 10rpx;
  281. margin-right: 34rpx;
  282. vertical-align: top;
  283. }
  284. }
  285. }
  286. }
  287. }
  288. </style>