环卫车小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
6.9 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <view>
  3. <view class="se-pos se-pos-lt" style="z-index: -1;width: 750rpx;height: 388rpx;
  4. background: linear-gradient(168deg,#669a32 0%, #669a32 72%);
  5. border-radius: 0rpx 0rpx 80rpx 80rpx;">
  6. </view>
  7. <view class="se-flex se-flex-h-sb se-px-20 se-pb-10 se-pt-10 se-zi-s" style="background-color: transparent;">
  8. <view class="se-c-white se-fs-28">
  9. <view class="se-c-white se-py-5 se-px-10 se-fw-6 se-br-12 se-fs-28 se-display-ib">
  10. 环保
  11. </view>
  12. <text class="se-ml-10 se-fw-6 se-fs-22">寻找你想要的</text>
  13. </view>
  14. </view>
  15. <view class="se-px-40 se-py-20">
  16. <view class=" se-br-50 se-c-black se-px-20 se-py-5 se-flex se-flex-h-sb se-fs-26">
  17. <view class="se-pl-10 se-pr-20 se-flex se-flex-h se-h-40 se-lh-40 " @click="handleAreaChange()">
  18. <text class="se-pr-20 se-c-white nobreak">{{city?city:'未知'}}</text>
  19. <u-icon name="arrow-down-fill" color="#ffffff"></u-icon>
  20. </view>
  21. <view class="se-ml-20 se-w-p-100">
  22. <u-search :disabled="true" @click="onSearch()" :showAction="false" bgColor="#ffffff" placeholder="搜索" v-model="keyword"></u-search>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="se-pb-20 se-pt-40 se-zi-s">
  27. <view class="se-px-20">
  28. <u-swiper height="300rpx" style="background-color: transparent;height: 300rpx;" keyName="image" :list="swiperList" @click="swiperClick"></u-swiper>
  29. </view>
  30. <!-- <view class="se-pt-10 se-bgc-white se-px-0 se-py-10 se-ta-l se-c-orange se-flex se-flex-ai-c se-fs-26">
  31. <image class="se-a-80" src="@/static/image/aed60x.png" mode=""></image>
  32. <text class="se-ml-10">今日有6个工作息新发布....</text>
  33. </view> -->
  34. </view>
  35. <view class="se-my-20 se-pt-20 se-bgc-white se-grid">
  36. <navigator :url="item.url" v-for="(item, index) in nav" :key="index" class="se-flex-v-c se-pt-10 se-mb-10">
  37. <image class="se-a-100 se-br-20" :src="item.img" mode=""></image>
  38. <text class="se-w-150 se-h-60 se-lh-30 se-c-black se-fs-22 se-ta-c se-mt-10 se-toe-2">{{item.name}}</text>
  39. </navigator>
  40. </view>
  41. <view class="se-px-30 se-py-30 se-bgc-white se-c-black">
  42. 精品二手车
  43. </view>
  44. <view class="se-grid-2">
  45. <view class="items-box se-br-5 se-px-10" v-for="(items,indexs) in list" :key="indexs" @click="onDetail(items)">
  46. <image class="se-w-p-100 se-h-200 se-py-5" :src="items.image" mode=""></image>
  47. <view class="se-c-black se-fs-24 se-fw-6 se-mt-10">
  48. {{ items.goodsName }}
  49. </view>
  50. <view class="se-flex se-mt-10">
  51. <view class="se-tag">
  52. {{items.cartypeId_dictText}}
  53. </view>
  54. <view class="se-tag">
  55. {{items.categorytwoId_dictText}}
  56. </view>
  57. </view>
  58. <view class="se-flex se-flex-h-sb se-w-p-100 se-pt-20">
  59. <view class="se-fs-24 se-display-ib">
  60. <text class="se-c-orange se-fs-30 se-fw-6"><text class="se-fs-24"></text>{{items.price}}<text class="se-fs-24"></text></text>
  61. </view>
  62. <view class="se-display-ib se-bgc-orange se-px-15 se-br-40 se-flex-h-c se-h-40 se-lh-40 se-ta-c se-fs-22 se-c-white se-b">
  63. <text>查看详情</text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import { getInfo,queryGoodsList,queryBannerList } from "@/common/api.js"
  72. import QQMapWX from "@/util/qqmap-wx-jssdk.min.js"
  73. export default{
  74. components:{
  75. },
  76. data(){
  77. return {
  78. city:"",
  79. swiperList: [
  80. "https://cdn.uviewui.com/uview/swiper/swiper1.png"
  81. ],
  82. nav:[
  83. {
  84. img:"../../static/image/nav1.png",
  85. name:"新车商城",
  86. url:"/pages_subpack/category/index"
  87. },
  88. {
  89. img:"../../static/image/nav2.png",
  90. name:"二手车商城",
  91. url:"/pages_subpack/category/index"
  92. },
  93. {
  94. img:"../../static/image/nav3.png",
  95. name:"环卫设备及配件",
  96. url:"/pages_subpack/category/index"
  97. },
  98. {
  99. img:"../../static/image/nav4.png",
  100. name:"车辆租赁",
  101. url:"/pages_subpack/category/index"
  102. },
  103. {
  104. img:"../../static/image/nav5.png",
  105. name:"新闻资讯",
  106. url:"/pages_subpack/news/index"
  107. },
  108. {
  109. img:"../../static/image/nav6.png",
  110. name:"帮助寻车",
  111. url:"/pages_subpack/category/index"
  112. }
  113. ],
  114. pageNo:1,
  115. pageSize:10,
  116. list:[]
  117. }
  118. },
  119. onLoad(options) {
  120. this.onPageList()
  121. this.getLocation()
  122. this.onQueryBannerList()
  123. },
  124. onPullDownRefresh() {
  125. let that = this
  126. that.pageNo = 1
  127. that.list = []
  128. that.onPageList()
  129. },
  130. onReachBottom() {
  131. let that = this
  132. that.pageNo = that.pageNo + 1
  133. that.onPageList()
  134. },
  135. methods:{
  136. onSearch(){
  137. uni.navigateTo({
  138. url:"/pages_subpack/category/index"
  139. })
  140. },
  141. handleAreaChange(){
  142. console.info("获取地址")
  143. },
  144. swiperClick(event){
  145. console.info(event)
  146. },
  147. onDetail(event){
  148. uni.navigateTo({
  149. url:"/pages_subpack/detail/index?goodsId="+event.id
  150. })
  151. },
  152. getLocation(){
  153. const that = this;
  154. wx.getLocation({
  155. type: 'wgs84',
  156. success: function (res) {
  157. console.log('当前位置的经度:' + res.longitude);
  158. console.log('当前位置的纬度:' + res.latitude);
  159. const qqmapsdk = new QQMapWX({
  160. key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
  161. });
  162. qqmapsdk.reverseGeocoder({
  163. location: {
  164. latitude: res.latitude,
  165. longitude: res.longitude
  166. },
  167. success: function(response) {
  168. that.city = response.result.ad_info.city
  169. console.log('逆地理编码结果:', response);
  170. },
  171. fail: function(error) {
  172. console.error('逆地理编码失败:', error);
  173. }
  174. });
  175. }
  176. })
  177. },
  178. onQueryBannerList(){
  179. let that = this
  180. let params={}
  181. queryBannerList(params).then(response=>{
  182. console.info("queryBannerList",response)
  183. that.swiperList = response.result.records
  184. }).catch(error=>{
  185. })
  186. },
  187. onPageList(){
  188. let that = this
  189. let params={
  190. pageNo:that.pageNo,
  191. pageSize:that.pageSize
  192. }
  193. queryGoodsList(params).then((response) => {
  194. console.info('queryGoodsList',response)
  195. that.list = that.list.concat(response.result.records)
  196. }).catch((error) =>{
  197. })
  198. },
  199. }
  200. }
  201. </script>
  202. <style>
  203. .nobreak {
  204. white-space: nowrap;
  205. }
  206. page{
  207. background-color: #f5f5f5;
  208. }
  209. .enterprise{
  210. background: #ff7a31;
  211. border: 4rpx solid rgba(255,255,255,0.50);
  212. border-radius: 14rpx;
  213. }
  214. .master{
  215. background: #f0b744;
  216. border: 4rpx solid rgba(255,255,255,0.50);
  217. border-radius: 14rpx;
  218. }
  219. .items-box{
  220. background: #ffffff;
  221. border-radius: 8rpx;
  222. box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0,0,0,0.05);
  223. padding: 20rpx;
  224. }
  225. .se-tag{
  226. padding: 5rpx 10rpx;
  227. background: #fff2df;
  228. border-radius: 4rpx;
  229. border: 2rpx solid rgba(0,0,0,0.00);
  230. font-size: 16rpx;
  231. font-family: PingFang SC, PingFang SC-Bold;
  232. font-weight: 700;
  233. text-align: center;
  234. color: #fab143;
  235. margin-left: 10rpx;
  236. }
  237. .se-tag:first-child{
  238. margin-left: 0rpx;
  239. }
  240. </style>