环卫车小程序前端代码
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.

298 lines
8.1 KiB

1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year 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-bgc-f5 se-br-5 se-py-5" :src="items.images[0]" 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. wx.showShareMenu({
  121. withShareTicket: true,
  122. menus: ['shareAppMessage', 'shareTimeline']
  123. });
  124. if(options.shareId){
  125. uni.setStorageSync('shareId',options.shareId)
  126. }
  127. this.onPageList()
  128. this.getLocation()
  129. this.onQueryBannerList()
  130. },
  131. onPullDownRefresh() {
  132. let that = this
  133. that.pageNo = 1
  134. that.list = []
  135. that.onPageList()
  136. },
  137. onReachBottom() {
  138. let that = this
  139. that.pageNo = that.pageNo + 1
  140. that.onPageList()
  141. },
  142. onShareAppMessage() {
  143. let share = {
  144. path:"/pages/home/index?shareId="+uni.getStorageSync('userInfo').id,
  145. success:(res) => {
  146. console.info(res)
  147. },
  148. fail:(err)=>{
  149. console.info(err)
  150. }
  151. }
  152. console.info(share)
  153. return share
  154. },
  155. methods:{
  156. onSearch(){
  157. uni.navigateTo({
  158. url:"/pages_subpack/category/index"
  159. })
  160. },
  161. handleAreaChange(){
  162. console.info("获取地址")
  163. },
  164. swiperClick(event){
  165. console.info(event)
  166. },
  167. onDetail(event){
  168. uni.navigateTo({
  169. url:"/pages_subpack/detail/index?goodsId="+event.id
  170. })
  171. },
  172. getLocation(){
  173. const that = this;
  174. wx.getLocation({
  175. type: 'wgs84',
  176. success: function (res) {
  177. console.log('当前位置的经度:' + res.longitude);
  178. console.log('当前位置的纬度:' + res.latitude);
  179. const qqmapsdk = new QQMapWX({
  180. key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
  181. });
  182. qqmapsdk.reverseGeocoder({
  183. location: {
  184. latitude: res.latitude,
  185. longitude: res.longitude
  186. },
  187. success: function(response) {
  188. that.city = response.result.ad_info.city
  189. console.log('逆地理编码结果:', response);
  190. },
  191. fail: function(error) {
  192. console.error('逆地理编码失败:', error);
  193. }
  194. });
  195. }
  196. })
  197. },
  198. onQueryBannerList(){
  199. let that = this
  200. let params={}
  201. queryBannerList(params).then(response=>{
  202. console.info("queryBannerList",response)
  203. that.swiperList = response.result.records
  204. }).catch(error=>{
  205. })
  206. },
  207. onPageList(){
  208. let that = this
  209. let params={
  210. pageNo:that.pageNo,
  211. pageSize:that.pageSize
  212. }
  213. queryGoodsList(params).then((response) => {
  214. console.info('queryGoodsList',response)
  215. response.result.records.forEach((items,indexs)=>{
  216. if(items.image){
  217. items.images = items.image.split(',')
  218. }else{
  219. items.images = []
  220. }
  221. if(items.imageBack){
  222. items.imageBacks = items.imageBack.split(',')
  223. }else{
  224. items.imageBacks = []
  225. }
  226. if(items.imageCab){
  227. items.imageCabs = items.imageCab.split(',')
  228. }else{
  229. items.imageCabs = []
  230. }
  231. if(items.imageFront){
  232. items.imageFronts = items.imageFront.split(',')
  233. }else{
  234. items.imageFronts = []
  235. }
  236. if(items.imageLeft){
  237. items.imageLefts = items.imageLeft.split(',')
  238. }else{
  239. items.imageLefts = []
  240. }
  241. if(items.imageRight){
  242. items.imageRights = items.imageRight.split(',')
  243. }else{
  244. items.imageRights = []
  245. }
  246. })
  247. that.list = that.list.concat(response.result.records)
  248. }).catch((error) =>{
  249. })
  250. },
  251. }
  252. }
  253. </script>
  254. <style>
  255. .nobreak {
  256. white-space: nowrap;
  257. }
  258. page{
  259. background-color: #f5f5f5;
  260. }
  261. .enterprise{
  262. background: #ff7a31;
  263. border: 4rpx solid rgba(255,255,255,0.50);
  264. border-radius: 14rpx;
  265. }
  266. .master{
  267. background: #f0b744;
  268. border: 4rpx solid rgba(255,255,255,0.50);
  269. border-radius: 14rpx;
  270. }
  271. .items-box{
  272. background: #ffffff;
  273. border-radius: 8rpx;
  274. box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0,0,0,0.05);
  275. padding: 20rpx;
  276. }
  277. .se-tag{
  278. padding: 5rpx 10rpx;
  279. background: #fff2df;
  280. border-radius: 4rpx;
  281. border: 2rpx solid rgba(0,0,0,0.00);
  282. font-size: 16rpx;
  283. font-family: PingFang SC, PingFang SC-Bold;
  284. font-weight: 700;
  285. text-align: center;
  286. color: #fab143;
  287. margin-left: 10rpx;
  288. }
  289. .se-tag:first-child{
  290. margin-left: 0rpx;
  291. }
  292. </style>